Make WordPress Core


Ignore:
Timestamp:
08/20/2019 10:41:02 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Accessibility: Make the Media modal an ARIA modal dialog.

For a number of years, the Media modal missed an explicit ARIA role and the required attributes for modal dialogs.

This was confusing for assistive technology users, since they may not realize they're inside a dialog, and that consequently the keyboard interactions may be different from the rest of the page. Lack of an explicit label for the dialog was confusing as well, since assistive technology users didn't have an immediate sense of what the dialog is for.

This change makes the Media modal meet the ARIA Authoring Practices recommendations, helping users better understand the purpose and interactions with the modal. Also, it makes sure to hide the rest of the page content from assistive technologies, until support for aria-modal="true" improves.

Additionally:

  • moves the modal H1 heading to the beginning of the modal content
  • changes the modal left menu position to make visual and DOM order match
  • improves the wp.media.view.FocusManager documentation

Props afercia.
Merges [45572] to the 5.2 branch.
Fixes #47145.

Location:
branches/5.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

  • branches/5.2/src/wp-includes/media-template.php

    r45865 r45866  
    186186    <![endif]-->
    187187    <script type="text/html" id="tmpl-media-frame">
     188        <div class="media-frame-title" id="media-frame-title"></div>
    188189        <div class="media-frame-menu"></div>
    189         <div class="media-frame-title"></div>
    190190        <div class="media-frame-router"></div>
    191191        <div class="media-frame-content"></div>
     
    195195
    196196    <script type="text/html" id="tmpl-media-modal">
    197         <div tabindex="0" class="<?php echo $class; ?>">
     197        <div tabindex="0" class="<?php echo $class; ?>" role="dialog" aria-modal="true" aria-labelledby="media-frame-title">
    198198            <# if ( data.hasCloseButton ) { #>
    199199                <button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></span></button>
    200200            <# } #>
    201             <div class="media-modal-content"></div>
     201            <div class="media-modal-content" role="document"></div>
    202202        </div>
    203203        <div class="media-modal-backdrop"></div>
Note: See TracChangeset for help on using the changeset viewer.