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.

Built from https://develop.svn.wordpress.org/trunk@39006


git-svn-id: http://core.svn.wordpress.org/trunk@38948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2016-10-29 12:54:30 +00:00
parent a1d18b7b8a
commit fd40a16ad1
2 changed files with 15 additions and 6 deletions

View File

@ -348,8 +348,11 @@ if ( is_multisite() ) {
</tr> </tr>
<?php if ( current_user_can( 'manage_network_users' ) ) { ?> <?php if ( current_user_can( 'manage_network_users' ) ) { ?>
<tr> <tr>
<th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></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> <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> </tr>
<?php } ?> <?php } ?>
</table> </table>
@ -462,7 +465,10 @@ $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unsl
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e( 'Send User Notification' ) ?></th> <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> </tr>
<?php } // !is_multisite ?> <?php } // !is_multisite ?>
<tr class="form-field"> <tr class="form-field">
@ -478,8 +484,11 @@ $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unsl
</tr> </tr>
<?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?> <?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?>
<tr> <tr>
<th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></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> <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> </tr>
<?php } ?> <?php } ?>
</table> </table>

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta1-39005'; $wp_version = '4.7-beta1-39006';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.