Skip to content

Commit e1fe605

Browse files
committed
Editor: A11y: Set aria-haspopup on Add Media button.
Add the `aria-haspopup` attribute and `aria-controls` on the Add Media button in the classic editor, so that screen reader users are notified about the behavior of the button. Props alh0319, rishabhwp, joedolson. Fixes #63973. git-svn-id: https://develop.svn.wordpress.org/trunk@60786 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2e7343c commit e1fe605

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-admin/includes/media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ function media_buttons( $editor_id = 'content' ) {
655655
$id_attribute = 1 === $instance ? ' id="insert-media-button"' : '';
656656

657657
printf(
658-
'<button type="button"%s class="button insert-media add_media" data-editor="%s">%s</button>',
658+
'<button type="button"%s class="button insert-media add_media" data-editor="%s" aria-haspopup="dialog" aria-controls="wp-media-modal">%s</button>',
659659
$id_attribute,
660660
esc_attr( $editor_id ),
661661
$img . __( 'Add Media' )

src/wp-includes/media-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function wp_print_media_templates() {
195195

196196
<?php // Template for the media modal. ?>
197197
<script type="text/html" id="tmpl-media-modal">
198-
<div tabindex="0" class="<?php echo $class; ?>" role="dialog" aria-labelledby="media-frame-title">
198+
<div id="wp-media-modal" tabindex="0" class="<?php echo $class; ?>" role="dialog" aria-labelledby="media-frame-title">
199199
<# if ( data.hasCloseButton ) { #>
200200
<button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text">
201201
<?php

0 commit comments

Comments
 (0)