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.


git-svn-id: https://develop.svn.wordpress.org/trunk@39006 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2016-10-29 12:53:44 +00:00
parent 404c584956
commit ea885d3a26
1 changed files with 14 additions and 5 deletions

View File

@ -348,8 +348,11 @@ if ( is_multisite() ) {
</tr>
<?php if ( current_user_can( 'manage_network_users' ) ) { ?>
<tr>
<th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
<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>
<th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
<td>
<input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" />
<label for="adduser-noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label>
</td>
</tr>
<?php } ?>
</table>
@ -462,7 +465,10 @@ $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unsl
</tr>
<tr>
<th scope="row"><?php _e( 'Send User Notification' ) ?></th>
<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>
<td>
<input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> />
<label for="send_user_notification"><?php _e( 'Send the new user an email about their account.' ); ?></label>
</td>
</tr>
<?php } // !is_multisite ?>
<tr class="form-field">
@ -478,8 +484,11 @@ $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unsl
</tr>
<?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?>
<tr>
<th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
<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>
<th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
<td>
<input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> />
<label for="noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label>
</td>
</tr>
<?php } ?>
</table>