Make WordPress Core


Ignore:
Timestamp:
02/23/2015 02:28:41 AM (10 years ago)
Author:
jeremyfelt
Message:

Provide proper label associations and descriptions throughout the network admin

  • Add labels previously missing for many inputs throughout the network admin screen.
  • Add proper aria-describedby attributes to provide better descriptions.
  • Wrap grouped inputs with fieldset elements.
  • Remove now unneeded title attributes when appropriate.

Props cfoellmann, afercia, rianrietveld.

Fixes #38406.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/settings.php

    r30705 r31517  
    135135                <th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th>
    136136                <td>
    137                     <input name="admin_email" type="email" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option( 'admin_email' ) ) ?>" />
    138                     <p class="description">
     137                    <input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-desc" class="regular-text" value="<?php echo esc_attr( get_site_option( 'admin_email' ) ) ?>" />
     138                    <p class="description" id="admin-email-desc">
    139139                        <?php _e( 'This email address will receive notifications. Registration and support emails will also come from this address.' ); ?>
    140140                    </p>
     
    152152                ?>
    153153                <td>
     154                    <fieldset>
     155                    <legend class="screen-reader-text"><?php _e( 'New registrations settings' ) ?></legend>
    154156                    <label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br />
    155157                    <label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br />
    156158                    <label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog') ?> /> <?php _e( 'Logged in users may register new sites.' ); ?></label><br />
    157159                    <label><input name="registration" type="radio" id="registration4" value="all"<?php checked( $reg, 'all') ?> /> <?php _e( 'Both sites and user accounts can be registered.' ); ?></label>
    158                     <p class="description">
    159                         <?php if ( is_subdomain_install() )
    160                         _e( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.' );
    161                     ?>
    162                     </p>
     160                    <?php if ( is_subdomain_install() ) {
     161                        echo '<p class="description">' . __( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.' ) . '</p>';
     162                    } ?>
     163                    </fieldset>
    163164                </td>
    164165            </tr>
     
    185186                <th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th>
    186187                <td>
    187                     <input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", (array) get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
    188                     <p class="description">
     188                    <input name="illegal_names" type="text" id="illegal_names" aria-describedby="illegal-names-desc" class="large-text" value="<?php echo esc_attr( implode( " ", (array) get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
     189                    <p class="description" id="illegal-names-desc">
    189190                        <?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?>
    190191                    </p>
     
    197198                    <?php $limited_email_domains = get_site_option( 'limited_email_domains' );
    198199                    $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?>
    199                     <textarea name="limited_email_domains" id="limited_email_domains" cols="45" rows="5">
     200                    <textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5">
    200201<?php echo esc_textarea( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>
    201                     <p class="description">
     202                    <p class="description" id="limited-email-domains-desc">
    202203                        <?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ) ?>
    203204                    </p>
     
    208209                <th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th>
    209210                <td>
    210                     <textarea name="banned_email_domains" id="banned_email_domains" cols="45" rows="5">
     211                    <textarea name="banned_email_domains" id="banned_email_domains" aria-describedby="banned-email-domains-desc" cols="45" rows="5">
    211212<?php echo esc_textarea( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea>
    212                     <p class="description">
     213                    <p class="description" id="banned-email-domains-desc">
    213214                        <?php _e( 'If you want to ban domains from site registrations. One domain per line.' ) ?>
    214215                    </p>
     
    223224                <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
    224225                <td>
    225                     <textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text">
     226                    <textarea name="welcome_email" id="welcome_email" aria-describedby="welcome-email-desc" rows="5" cols="45" class="large-text">
    226227<?php echo esc_textarea( get_site_option( 'welcome_email' ) ) ?></textarea>
    227                     <p class="description">
     228                    <p class="description" id="welcome-email-desc">
    228229                        <?php _e( 'The welcome email sent to new site owners.' ) ?>
    229230                    </p>
     
    233234                <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th>
    234235                <td>
    235                     <textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text">
     236                    <textarea name="welcome_user_email" id="welcome_user_email" aria-describedby="welcome-user-email-desc" rows="5" cols="45" class="large-text">
    236237<?php echo esc_textarea( get_site_option( 'welcome_user_email' ) ) ?></textarea>
    237                     <p class="description">
     238                    <p class="description" id="welcome-user-email-desc">
    238239                        <?php _e( 'The welcome email sent to new users.' ) ?>
    239240                    </p>
     
    243244                <th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th>
    244245                <td>
    245                     <textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text">
     246                    <textarea name="first_post" id="first_post" aria-describedby="first-post-desc" rows="5" cols="45" class="large-text">
    246247<?php echo esc_textarea( get_site_option( 'first_post' ) ) ?></textarea>
    247                     <p class="description">
     248                    <p class="description" id="first-post-desc">
    248249                        <?php _e( 'The first post on a new site.' ) ?>
    249250                    </p>
     
    253254                <th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th>
    254255                <td>
    255                     <textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text">
     256                    <textarea name="first_page" id="first_page" aria-describedby="first-page-desc" rows="5" cols="45" class="large-text">
    256257<?php echo esc_textarea( get_site_option( 'first_page' ) ) ?></textarea>
    257                     <p class="description">
     258                    <p class="description" id="first-page-desc">
    258259                        <?php _e( 'The first page on a new site.' ) ?>
    259260                    </p>
     
    263264                <th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th>
    264265                <td>
    265                     <textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text">
     266                    <textarea name="first_comment" id="first_comment" aria-describedby="first-comment-desc" rows="5" cols="45" class="large-text">
    266267<?php echo esc_textarea( get_site_option( 'first_comment' ) ) ?></textarea>
    267                     <p class="description">
     268                    <p class="description" id="first-comment-desc">
    268269                        <?php _e( 'The first comment on a new site.' ) ?>
    269270                    </p>
     
    273274                <th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th>
    274275                <td>
    275                     <input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
    276                     <p class="description">
     276                    <input type="text" size="40" name="first_comment_author" id="first_comment_author" aria-describedby="first-comment-author-desc" value="<?php echo get_site_option('first_comment_author') ?>" />
     277                    <p class="description" id="first-comment-author-desc">
    277278                        <?php _e( 'The author of the first comment on a new site.' ) ?>
    278279                    </p>
     
    282283                <th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th>
    283284                <td>
    284                     <input type="text" size="40" name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" />
    285                     <p class="description">
     285                    <input type="text" size="40" name="first_comment_url" id="first_comment_url" aria-describedby="first-comment-url-desc" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" />
     286                    <p class="description" id="first-comment-url-desc">
    286287                        <?php _e( 'The URL for the first comment on a new site.' ) ?>
    287288                    </p>
     
    294295                <th scope="row"><?php _e( 'Site upload space' ) ?></th>
    295296                <td>
    296                 <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label><br />
     297                    <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" aria-describedby="blog-upload-space-desc" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label><br />
     298                    <p class="screen-reader-text" id="blog-upload-space-desc">
     299                        <?php _e( 'Size in megabytes' ) ?>
     300                    </p>
    297301                </td>
    298302            </tr>
     
    300304            <tr>
    301305                <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th>
    302                 <td><input name="upload_filetypes" type="text" id="upload_filetypes" class="large-text" value="<?php echo esc_attr( get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) ) ?>" size="45" /></td>
     306                <td>
     307                    <input name="upload_filetypes" type="text" id="upload_filetypes" aria-describedby="upload-filetypes-desc" class="large-text" value="<?php echo esc_attr( get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) ) ?>" size="45" />
     308                    <p class="description" id="upload-filetypes-desc">
     309                        <?php _e( 'Allowed file types. Separate types by spaces.' ) ?>
     310                    </p>
     311                </td>
    303312            </tr>
    304313
    305314            <tr>
    306315                <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th>
    307                 <td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" />' ); ?></td>
     316                <td>
     317                    <?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" aria-describedby="fileupload-maxk-desc" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" />' ); ?>
     318                    <p class="screen-reader-text" id="fileupload-maxk-desc">
     319                        <?php _e( 'Size in kilobytes' ) ?>
     320                    </p>
     321                </td>
    308322            </tr>
    309323        </table>
     
    364378             */
    365379            $menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) );
     380            $fieldset_end = '';
     381            if ( count( (array) $menu_items ) > 1 ) {
     382                echo '<fieldset><legend class="screen-reader-text">' . __( 'Enable menus' ) . '</legend>';
     383                $fieldset_end = '</fieldset>';
     384            }
    366385            foreach ( (array) $menu_items as $key => $val ) {
    367386                echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[$key] ) ? checked( $menu_perms[$key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>";
    368387            }
     388            echo $fieldset_end;
    369389            ?>
    370390                </td>
Note: See TracChangeset for help on using the changeset viewer.