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-section.php

    r56551 r59224  
    356356        ?>
    357357        <li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }}">
    358             <h3 class="accordion-section-title" tabindex="0">
    359                 {{ data.title }}
    360                 <span class="screen-reader-text">
    361                     <?php
    362                     /* translators: Hidden accessibility text. */
    363                     _e( 'Press return or enter to open this section' );
    364                     ?>
    365                 </span>
     358            <h3 class="accordion-section-title">
     359                <button type="button" class="accordion-trigger" aria-expanded="false" aria-controls="{{ data.id }}-content">
     360                    {{ data.title }}
     361                </button>
    366362            </h3>
    367             <ul class="accordion-section-content">
     363            <ul class="accordion-section-content" id="{{ data.id }}-content">
    368364                <li class="customize-section-description-container section-meta <# if ( data.description_hidden ) { #>customize-info<# } #>">
    369365                    <div class="customize-section-title">
Note: See TracChangeset for help on using the changeset viewer.