Make WordPress Core


Ignore:
Timestamp:
05/14/2024 04:47:03 PM (2 months ago)
Author:
joedolson
Message:

Administration: A11y: Replace placeholders with visible labels.

Add visible labels to inputs that are using placeholder attributes as a substitute for visible labeling.

Labels added or made visible on the customizer theme search, customizer widget search, customizer menu item search, customizer new page UI, the search plugins screens, the media search screens, and the classic editor link inserter.

Props afercia, joedolson, rcreators, sabernhardt.
See #40331.

File:
1 edited

Legend:

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

    r57644 r58146  
    11641164            <div id="available-menu-items-search" class="accordion-section cannot-expand">
    11651165                <div class="accordion-section-title">
    1166                     <label class="screen-reader-text" for="menu-items-search">
    1167                         <?php
    1168                         /* translators: Hidden accessibility text. */
    1169                         _e( 'Search Menu Items' );
    1170                         ?>
    1171                     </label>
    1172                     <input type="text" id="menu-items-search" placeholder="<?php esc_attr_e( 'Search menu items&hellip;' ); ?>" aria-describedby="menu-items-search-desc" />
     1166                    <label for="menu-items-search"><?php _e( 'Search Menu Items' ); ?></label>
     1167                    <input type="text" id="menu-items-search" aria-describedby="menu-items-search-desc" />
    11731168                    <p class="screen-reader-text" id="menu-items-search-desc">
    11741169                        <?php
     
    11781173                    </p>
    11791174                    <span class="spinner"></span>
     1175                    <div class="search-icon" aria-hidden="true"></div>
     1176                    <button type="button" class="clear-results"><span class="screen-reader-text">
     1177                        <?php
     1178                        /* translators: Hidden accessibility text. */
     1179                        _e( 'Clear Results' );
     1180                        ?>
     1181                    </span></button>
    11801182                </div>
    1181                 <div class="search-icon" aria-hidden="true"></div>
    1182                 <button type="button" class="clear-results"><span class="screen-reader-text">
    1183                     <?php
    1184                     /* translators: Hidden accessibility text. */
    1185                     _e( 'Clear Results' );
    1186                     ?>
    1187                 </span></button>
    11881183                <ul class="accordion-section-content available-menu-items-list" data-type="search"></ul>
    11891184            </div>
     
    12441239                    <?php $post_type_obj = get_post_type_object( $available_item_type['object'] ); ?>
    12451240                    <?php if ( current_user_can( $post_type_obj->cap->create_posts ) && current_user_can( $post_type_obj->cap->publish_posts ) ) : ?>
    1246                         <div class="new-content-item">
    1247                             <label for="<?php echo esc_attr( 'create-item-input-' . $available_item_type['object'] ); ?>" class="screen-reader-text"><?php echo esc_html( $post_type_obj->labels->add_new_item ); ?></label>
    1248                             <input type="text" id="<?php echo esc_attr( 'create-item-input-' . $available_item_type['object'] ); ?>" class="create-item-input" placeholder="<?php echo esc_attr( $post_type_obj->labels->add_new_item ); ?>">
    1249                             <button type="button" class="button add-content"><?php _e( 'Add' ); ?></button>
     1241                        <div class="new-content-item-wrapper">
     1242                            <label for="<?php echo esc_attr( 'create-item-input-' . $available_item_type['object'] ); ?>"><?php echo esc_html( $post_type_obj->labels->add_new_item ); ?></label>
     1243                            <div class="new-content-item">
     1244                                <input type="text" id="<?php echo esc_attr( 'create-item-input-' . $available_item_type['object'] ); ?>" class="create-item-input">
     1245                                <button type="button" class="button add-content"><?php _e( 'Add' ); ?></button>
     1246                            </div>
    12501247                        </div>
    12511248                    <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.