Make WordPress Core


Ignore:
Timestamp:
10/08/2026 11:33:48 AM (9 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/includes/theme.php

    r63494 r64241  
    829829                                        <?php
    830830                                        /* translators: Hidden accessibility text. */
    831                                         _e( 'Show previous theme' );
     831                                        _ex( 'Previous', 'theme' );
    832832                                        ?>
    833833                                </span></button>
    … …  
    835835                                        <?php
    836836                                        /* translators: Hidden accessibility text. */
    837                                         _e( 'Show next theme' );
     837                                        _ex( 'Next', 'theme' );
    838838                                        ?>
    839839                                </span></button>
Note: See TracChangeset for help on using the changeset viewer.