Make WordPress Core


Ignore:
Timestamp:
10/08/2026 11:33:48 AM (10 days ago)
Author:
afercia
Message:

Administration: Improve focus management and screen reader announcements when navigating the media and theme browsers.

In the various media and theme browsers, the announcements for screen readers were sometimes too noisy because focus was set too often and unnecessarily on some elements. To improve the announcements and move focus only when really necessary, all the media and theme browsers are now standardized to the following pattern:

  • Makes sure all the media and theme browsers have a dialog role.
  • Keeps the navigation buttons focusable by using aria-disabled instead of disabled.
  • Ensures that screen reader announcements are cleaner by keeping focus on the activated control rather than moving it to another element.
  • Makes sure initial focus is set to the dialog element when it is opened.
  • Makes sure to return focus to the opener control when the dialog is closed.
  • Makes sure the opener control is a focusable element.
  • Adjusts styles accordingly to take the aria-disabled attribute into account.
  • Simplifies the buttons accessible name to: Previous / Next / Close.
  • Makes sure the ARIA live regions are not hidden when they inherit visibility: hidden.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13816

Props sukhendu2002, khokansardar, afercia.
Fixes #65746.

File:
1 edited

Legend:

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

    r62878 r64241  
    665665        </div>
    666666</div>
    667 <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
     667<div class="theme-overlay theme-overlay-initial" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
    668668
    669669<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    … …  
    10581058                                <?php
    10591059                                /* translators: Hidden accessibility text. */
    1060                                 _e( 'Show previous theme' );
     1060                                _ex( 'Previous', 'theme' );
    10611061                                ?>
    10621062                        </span></button>
    … …  
    10641064                                <?php
    10651065                                /* translators: Hidden accessibility text. */
    1066                                 _e( 'Show next theme' );
     1066                                _ex( 'Next', 'theme' );
    10671067                                ?>
    10681068                        </span></button>
    … …  
    10701070                                <?php
    10711071                                /* translators: Hidden accessibility text. */
    1072                                 _e( 'Close details dialog' );
     1072                                _e( 'Close' );
    10731073                                ?>
    10741074                        </span></button>
Note: See TracChangeset for help on using the changeset viewer.