Accessibility: Networks and Sites: mark the New Site required form fields as required.

Also, adds an `aria-describedby` attribute to associate the Admin Email field with its description.

Props dipesh.kakadiya, jackreichert, rianrietveld.
Fixes #37331.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2018-03-07 19:41:33 +00:00
parent 51b0a3cd28
commit e34999f4aa
2 changed files with 16 additions and 9 deletions

View File

@ -212,19 +212,26 @@ if ( ! empty( $messages ) ) {
}
}
?>
<p><?php
printf(
/* translators: %s: asterisk to mark required form fields. */
__( 'Required fields are marked %s' ),
'<span class="required">*</span>'
);
?></p>
<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate">
<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?>
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ); ?></label></th>
<th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ); ?> <span class="required">*</span></label></th>
<td>
<?php if ( is_subdomain_install() ) { ?>
<input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_network()->domain ); ?></span>
<input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" required /><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_network()->domain ); ?></span>
<?php
} else {
echo get_network()->domain . get_network()->path
?>
<input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" />
<input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" required />
<?php
}
echo '<p class="description" id="site-address-desc">' . __( 'Only lowercase letters (a-z), numbers, and hyphens are allowed.' ) . '</p>';
@ -232,8 +239,8 @@ if ( ! empty( $messages ) ) {
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="site-title"><?php _e( 'Site Title' ); ?></label></th>
<td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td>
<th scope="row"><label for="site-title"><?php _e( 'Site Title' ); ?> <span class="required">*</span></label></th>
<td><input name="blog[title]" type="text" class="regular-text" id="site-title" required /></td>
</tr>
<?php
$languages = get_available_languages();
@ -267,11 +274,11 @@ if ( ! empty( $messages ) ) {
</tr>
<?php endif; // Languages. ?>
<tr class="form-field form-required">
<th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ); ?></label></th>
<td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" /></td>
<th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ); ?> <span class="required">*</span></label></th>
<td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" aria-describedby="site-admin-email" required /></td>
</tr>
<tr class="form-field">
<td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ); ?><br /><?php _e( 'The username and a link to set the password will be mailed to this email address.' ); ?></td>
<td colspan="2"><p id="site-admin-email"><?php _e( 'A new user will be created if the above email address is not in the database.' ); ?><br /><?php _e( 'The username and a link to set the password will be mailed to this email address.' ); ?></p></td>
</tr>
</table>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42792';
$wp_version = '5.0-alpha-42793';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.