Make WordPress Core


Ignore:
Timestamp:
10/13/2024 07:07:06 PM (5 months ago)
Author:
joedolson
Message:

Administration: A11y: Fix accordion accessibility.

Change accordions in the customizer and the navigation menus to make proper usage of accordion markup patterns. This includes adding missing :focus states, using a button element to control tabbing and interaction, instead of the heading elements, and removing instructional text for screen reader users that was used to compensate for the incorrect markup pattern.

Props afercia, rishishah, kushang78, rcreators, krupajnanda, hmbashar, joedolson.
Fixes #42002.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-panel.php

    r56551 r59224  
    347347        ?>
    348348        <li id="accordion-panel-{{ data.id }}" class="accordion-section control-section control-panel control-panel-{{ data.type }}">
    349             <h3 class="accordion-section-title" tabindex="0">
    350                 {{ data.title }}
    351                 <span class="screen-reader-text">
    352                     <?php
    353                     /* translators: Hidden accessibility text. */
    354                     _e( 'Press return or enter to open this panel' );
    355                     ?>
    356                 </span>
     349            <h3 class="accordion-section-title">
     350                <button type="button" class="accordion-trigger" aria-expanded="false" aria-controls="{{ data.id }}-content">
     351                    {{ data.title }}
     352                </button>
    357353            </h3>
    358             <ul class="accordion-sub-container control-panel-content"></ul>
     354            <ul class="accordion-sub-container control-panel-content" id="{{ data.id }}-content"></ul>
    359355        </li>
    360356        <?php
Note: See TracChangeset for help on using the changeset viewer.