Make WordPress Core


Ignore:
Timestamp:
09/28/2025 11:38:57 PM (7 weeks ago)
Author:
joedolson
Message:

A11y: Ensure icons are not spoken by screen readers.

For all CSS generated icons across core, either add aria-hidden="true" to the HTML wrapper or set the generated content alternative to an empty string in the CSS using the alternative text specification for CSS generated content.

Props afercia, joedolson, cheffheid, jhabdas.
Fixes #40428.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r60530 r60806  
    10771077                }
    10781078
    1079                 $failures[ $library ] = "<span class='dashicons $class'><span class='screen-reader-text'>$screen_reader</span></span> $message";
     1079                $failures[ $library ] = "<span class='dashicons $class' aria-hidden='true'></span><span class='screen-reader-text'>$screen_reader</span> $message";
    10801080            }
    10811081        }
     
    24412441
    24422442        if ( empty( $page_cache_detail['response_time'] ) ) {
    2443             $page_cache_test_summary[] = '<span class="dashicons dashicons-dismiss"></span> ' . __( 'Server response time could not be determined. Verify that loopback requests are working.' );
     2443            $page_cache_test_summary[] = '<span class="dashicons dashicons-dismiss" aria-hidden="true"></span> ' . __( 'Server response time could not be determined. Verify that loopback requests are working.' );
    24442444        } else {
    24452445
    24462446            $threshold = $this->get_good_response_time_threshold();
    24472447            if ( $page_cache_detail['response_time'] < $threshold ) {
    2448                 $page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt"></span> ' . sprintf(
     2448                $page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt" aria-hidden="true"></span> ' . sprintf(
    24492449                    /* translators: 1: The response time in milliseconds, 2: The recommended threshold in milliseconds. */
    24502450                    __( 'Median server response time was %1$s milliseconds. This is less than the recommended %2$s milliseconds threshold.' ),
     
    24532453                );
    24542454            } else {
    2455                 $page_cache_test_summary[] = '<span class="dashicons dashicons-warning"></span> ' . sprintf(
     2455                $page_cache_test_summary[] = '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' . sprintf(
    24562456                    /* translators: 1: The response time in milliseconds, 2: The recommended threshold in milliseconds. */
    24572457                    __( 'Median server response time was %1$s milliseconds. It should be less than the recommended %2$s milliseconds threshold.' ),
     
    24622462
    24632463            if ( empty( $page_cache_detail['headers'] ) ) {
    2464                 $page_cache_test_summary[] = '<span class="dashicons dashicons-warning"></span> ' . __( 'No client caching response headers were detected.' );
     2464                $page_cache_test_summary[] = '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' . __( 'No client caching response headers were detected.' );
    24652465            } else {
    2466                 $headers_summary  = '<span class="dashicons dashicons-yes-alt"></span>';
     2466                $headers_summary  = '<span class="dashicons dashicons-yes-alt" aria-hidden="true"></span>';
    24672467                $headers_summary .= ' ' . sprintf(
    24682468                    /* translators: %d: Number of caching headers. */
     
    24802480
    24812481        if ( $page_cache_detail['advanced_cache_present'] ) {
    2482             $page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt"></span> ' . __( 'A page cache plugin was detected.' );
     2482            $page_cache_test_summary[] = '<span class="dashicons dashicons-yes-alt" aria-hidden="true"></span> ' . __( 'A page cache plugin was detected.' );
    24832483        } elseif ( ! ( is_array( $page_cache_detail ) && ! empty( $page_cache_detail['headers'] ) ) ) {
    24842484            // Note: This message is not shown if client caching response headers were present since an external caching layer may be employed.
    2485             $page_cache_test_summary[] = '<span class="dashicons dashicons-warning"></span> ' . __( 'A page cache plugin was not detected.' );
     2485            $page_cache_test_summary[] = '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' . __( 'A page cache plugin was not detected.' );
    24862486        }
    24872487
Note: See TracChangeset for help on using the changeset viewer.