From 425d6fd92587f11e778c364918130cf2b813204f Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Sun, 1 Sep 2019 15:17:37 +0000 Subject: [PATCH] Accessibility: Add a default title for the media modal dialog. Makes sure the media modal dialog `h1` heading isn't empty when custom media frames don't set a title. This is particularly important now that the media modal is an ARIA dialog, as the title is referenced by an `aria-labelledby` attribute to properly label the dialog. Props donmhico, audrasjb. Fixes #47612. git-svn-id: https://develop.svn.wordpress.org/trunk@45925 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/media/views/media-frame.js | 3 ++- src/wp-includes/media.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/media/views/media-frame.js b/src/js/media/views/media-frame.js index 50a97f8045..6d7e720639 100644 --- a/src/js/media/views/media-frame.js +++ b/src/js/media/views/media-frame.js @@ -1,4 +1,5 @@ var Frame = wp.media.view.Frame, + l10n = wp.media.view.l10n, $ = jQuery, MediaFrame; @@ -32,7 +33,7 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{ Frame.prototype.initialize.apply( this, arguments ); _.defaults( this.options, { - title: '', + title: l10n.mediaFrameDefaultTitle, modal: true, uploader: true }); diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 27b1eb8f6e..4b044b0149 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -3764,6 +3764,7 @@ function wp_enqueue_media( $args = array() ) { $strings = array( // Generic + 'mediaFrameDefaultTitle' => __( 'Media' ), 'url' => __( 'URL' ), 'addMedia' => __( 'Add Media' ), 'search' => __( 'Search' ),