Make WordPress Core

Changeset 60786


Ignore:
Timestamp:
09/19/2025 08:52:52 PM (15 hours ago)
Author:
joedolson
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r60681 r60786  
    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 ),
  • trunk/src/wp-includes/media-template.php

    r60266 r60786  
    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">
Note: See TracChangeset for help on using the changeset viewer.