Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/js/media/views/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Attachments = View.extend(/** @lends wp.media.view.Attachments.prototype */{
className: 'attachments',

attributes: {
role: 'group',
tabIndex: -1
},

Expand Down
4 changes: 3 additions & 1 deletion src/js/media/views/media-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{
* @this wp.media.controller.Region
*/
createTitle: function( title ) {
// A modal's dialog element points `aria-labelledby` at its frame heading.
title.view = new wp.media.View({
controller: this,
tagName: 'h1'
tagName: 'h1',
attributes: this.modal ? { id: this.modal.titleId } : {}
});
},
/**
Expand Down
7 changes: 6 additions & 1 deletion src/js/media/views/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,24 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
hasCloseButton: true
});

this.titleId = _.uniqueId( 'media-frame-title-' );

this.focusManager = new wp.media.view.FocusManager({
el: this.el
});
},
/**
* Prepares the data for the modal template.
*
* @since 7.2.0 Added the `titleId` property.
*
* @return {Object} The prepared data.
*/
prepare: function() {
return {
title: this.options.title,
hasCloseButton: this.options.hasCloseButton
hasCloseButton: this.options.hasCloseButton,
titleId: this.titleId
};
},

Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/media-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function wp_print_media_templates() {

<?php // Template for the media frame: used both in the media grid and in the media modal. ?>
<script type="text/html" id="tmpl-media-frame">
<div class="media-frame-title" id="media-frame-title"></div>
<div class="media-frame-title"></div>
<h2 class="media-frame-menu-heading"><?php _ex( 'Actions', 'media modal menu actions' ); ?></h2>
<button type="button" class="button button-link media-frame-menu-toggle" aria-expanded="false">
<?php _ex( 'Menu', 'media modal menu' ); ?>
Expand All @@ -201,7 +201,7 @@ function wp_print_media_templates() {

<?php // Template for the media modal. ?>
<script type="text/html" id="tmpl-media-modal">
<div id="wp-media-modal" tabindex="0" class="<?php echo $class; ?>" role="dialog" aria-labelledby="media-frame-title">
<div id="wp-media-modal" tabindex="0" class="<?php echo $class; ?>" role="dialog" aria-labelledby="{{ data.titleId }}">
<# if ( data.hasCloseButton ) { #>
<button type="button" class="media-modal-close"><span class="media-modal-icon" aria-hidden="true"></span><span class="screen-reader-text">
<?php
Expand Down
Loading