Make WordPress Core


Ignore:
Timestamp:
08/19/2022 11:04:04 PM (2 years ago)
Author:
joedolson
Message:

Taxonomy: Associate field descriptions with fields.

Use aria-describedby to associate the field descriptions and instructions with the form fields when creating or editing taxonomy terms.

Props afercia.
Fixes #55651.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tag-form.php

    r53455 r53913  
    146146        <tr class="form-field form-required term-name-wrap">
    147147            <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
    148             <td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" />
    149             <p class="description"><?php echo $tax->labels->name_field_description; ?></p></td>
     148            <td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" aria-describedby="name-description" />
     149            <p class="description" id="name-description"><?php echo $tax->labels->name_field_description; ?></p></td>
    150150        </tr>
    151151<?php if ( ! global_terms_enabled() ) { ?>
     
    168168            $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : '';
    169169            ?>
    170             <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" />
    171             <p class="description"><?php echo $tax->labels->slug_field_description; ?></p></td>
     170            <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" aria-describedby="slug-description" />
     171            <p class="description" id="slug-description"><?php echo $tax->labels->slug_field_description; ?></p></td>
    172172        </tr>
    173173<?php } ?>
     
    187187                    'hierarchical'     => true,
    188188                    'show_option_none' => __( 'None' ),
     189                    'aria_describedby' => 'parent-description',
    189190                );
    190191
     
    194195                ?>
    195196                <?php if ( 'category' === $taxonomy ) : ?>
    196                     <p class="description"><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p>
     197                    <p class="description" id="parent-description"><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p>
    197198                <?php else : ?>
    198                     <p class="description"><?php echo $tax->labels->parent_field_description; ?></p>
     199                    <p class="description" id="parent-description"><?php echo $tax->labels->parent_field_description; ?></p>
    199200                <?php endif; ?>
    200201            </td>
     
    203204        <tr class="form-field term-description-wrap">
    204205            <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
    205             <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
    206             <p class="description"><?php echo $tax->labels->desc_field_description; ?></p></td>
     206            <td><textarea name="description" id="description" rows="5" cols="50" class="large-text" aria-describedby="description-description"><?php echo $tag->description; // textarea_escaped ?></textarea>
     207            <p class="description" id="description-description"><?php echo $tax->labels->desc_field_description; ?></p></td>
    207208        </tr>
    208209        <?php
Note: See TracChangeset for help on using the changeset viewer.