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.


git-svn-id: https://develop.svn.wordpress.org/trunk@42793 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2018-03-07 19:40:58 +00:00
parent 3a46cba430
commit 77fbbbdbec

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>