Make WordPress Core


Ignore:
Timestamp:
10/29/2016 12:53:44 PM (8 years ago)
Author:
afercia
Message:

Accessibility: Improve the form labels on the Add New User screen.

On the Multisite - single site "Add New User" screen, some form fields have more
than one label associated with them. Form controls should have at most one
associated label element. If more than one label element is associated to the
control, assistive technologies may not read the appropriate label.

Additionally, labels can be associated to their related form fields either
explicitly (using a for attribute referencing the field ID) or implicitly
(using the label to wrap the field). As a best practice, never do both and
prefer explicitly associated labels when possible.

Props Ankit K Gupta.
Fixes #38459.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-new.php

    r38961 r39006  
    349349<?php if ( current_user_can( 'manage_network_users' ) ) { ?>
    350350    <tr>
    351         <th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
    352         <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td>
     351        <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
     352        <td>
     353            <input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" />
     354            <label for="adduser-noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label>
     355        </td>
    353356    </tr>
    354357<?php } ?>
     
    463466    <tr>
    464467        <th scope="row"><?php _e( 'Send User Notification' ) ?></th>
    465         <td><label for="send_user_notification"><input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> /> <?php _e( 'Send the new user an email about their account.' ); ?></label></td>
     468        <td>
     469            <input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> />
     470            <label for="send_user_notification"><?php _e( 'Send the new user an email about their account.' ); ?></label>
     471        </td>
    466472    </tr>
    467473<?php } // !is_multisite ?>
     
    479485    <?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?>
    480486    <tr>
    481         <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
    482         <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td>
     487        <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
     488        <td>
     489            <input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> />
     490            <label for="noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label>
     491        </td>
    483492    </tr>
    484493    <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.