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

    r53827 r53913  
    454454<div class="form-field form-required term-name-wrap">
    455455    <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
    456     <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
    457     <p><?php echo $tax->labels->name_field_description; ?></p>
     456    <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" aria-describedby="name-description" />
     457    <p id="name-description"><?php echo $tax->labels->name_field_description; ?></p>
    458458</div>
    459459    <?php if ( ! global_terms_enabled() ) : ?>
    460460<div class="form-field term-slug-wrap">
    461461    <label for="tag-slug"><?php _e( 'Slug' ); ?></label>
    462     <input name="slug" id="tag-slug" type="text" value="" size="40" />
    463     <p><?php echo $tax->labels->slug_field_description; ?></p>
     462    <input name="slug" id="tag-slug" type="text" value="" size="40" aria-describedby="slug-description" />
     463    <p id="slug-description"><?php echo $tax->labels->slug_field_description; ?></p>
    464464</div>
    465465<?php endif; // global_terms_enabled() ?>
     
    501501        $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );
    502502
     503        $dropdown_args['aria_describedby'] = 'parent-description';
     504
    503505        wp_dropdown_categories( $dropdown_args );
    504506        ?>
    505507        <?php if ( 'category' === $taxonomy ) : ?>
    506         <p><?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>
     508        <p 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>
    507509    <?php else : ?>
    508         <p><?php echo $tax->labels->parent_field_description; ?></p>
     510        <p id="parent-description"><?php echo $tax->labels->parent_field_description; ?></p>
    509511    <?php endif; ?>
    510512</div>
     
    512514<div class="form-field term-description-wrap">
    513515    <label for="tag-description"><?php _e( 'Description' ); ?></label>
    514     <textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
    515     <p><?php echo $tax->labels->desc_field_description; ?></p>
     516    <textarea name="description" id="tag-description" rows="5" cols="40" aria-describedby="description-description"></textarea>
     517    <p id="description-description"><?php echo $tax->labels->desc_field_description; ?></p>
    516518</div>
    517519
Note: See TracChangeset for help on using the changeset viewer.