Upgrade/Install: Add aria-describedby for input descriptions.

Accessibly associate field description text with relevant input fields. Add `aria-describedby` and target IDs for each description field. Update privacy text note to better reflect relevancy to specific fields.

Props costdev, joedolson.
Fixes #58613.
Built from https://develop.svn.wordpress.org/trunk@56024


git-svn-id: http://core.svn.wordpress.org/trunk@55536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2023-06-25 18:44:23 +00:00
parent abc3ea5422
commit 8d987eef49
2 changed files with 11 additions and 11 deletions

View File

@ -123,8 +123,8 @@ function display_setup_form( $error = null ) {
echo '<input name="user_name" type="hidden" value="admin" />';
} else {
?>
<input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
<p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p>
<input name="user_name" type="text" id="user_login" size="25" aria-describedby="user-name-desc" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
<p id="user-name-desc"><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p>
<?php
}
?>
@ -141,7 +141,7 @@ function display_setup_form( $error = null ) {
<div class="wp-pwd">
<?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?>
<div class="password-input-wrapper">
<input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
<input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result admin-password-desc" />
<div id="pass-strength-result" aria-live="polite"></div>
</div>
<button type="button" class="button wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
@ -149,7 +149,7 @@ function display_setup_form( $error = null ) {
<span class="text"><?php _e( 'Hide' ); ?></span>
</button>
</div>
<p><span class="description important hide-if-no-js">
<p id="admin-password-desc"><span class="description important hide-if-no-js">
<strong><?php _e( 'Important:' ); ?></strong>
<?php /* translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?>
<?php _e( 'You will need this password to log&nbsp;in. Please store it in a secure location.' ); ?></span></p>
@ -177,8 +177,8 @@ function display_setup_form( $error = null ) {
<?php endif; ?>
<tr>
<th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th>
<td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" />
<p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
<td><input name="admin_email" type="email" id="admin_email" size="25" aria-describedby="admin-email-desc" value="<?php echo esc_attr( $admin_email ); ?>" />
<p id="admin-email-desc"><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
</tr>
<tr>
<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?></th>
@ -198,17 +198,17 @@ function display_setup_form( $error = null ) {
?>
<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> />
<label for="blog-public"><?php _e( 'Allow search engines to index this site' ); ?></label><br />
<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> />
<input id="blog-norobots" type="radio" name="blog_public" aria-describedby="public-desc" value="0" <?php checked( 0, $blog_public ); ?> />
<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
<p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
<p id="public-desc" class="description"><?php _e( 'Note: Discouraging search engines does not block access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
<?php
/** This action is documented in wp-admin/options-reading.php */
do_action( 'blog_privacy_selector' );
} else {
?>
<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> />
<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" aria-describedby="privacy-desc" value="0" <?php checked( 0, $blog_public ); ?> />
<?php _e( 'Discourage search engines from indexing this site' ); ?></label>
<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
<p id="privacy-desc" class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
<?php } ?>
</fieldset>
</td>

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-alpha-56023';
$wp_version = '6.3-alpha-56024';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.