Accessibility: Make sure layout tables across the admin are correctly linearized.

Adds `role="presentation"` to the `<table>` elements used for layout purposes.

Ideally, HTML tables should be used for tabular data. When tables are used for layout purposes, it's important to remove any native semantics so that assistive technologies can correctly announce the table content in a linearized fashion.

Props greatislander, afercia.
Fixes #46899.
Built from https://develop.svn.wordpress.org/trunk@45403


git-svn-id: http://core.svn.wordpress.org/trunk@45214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-05-24 21:56:54 +00:00
parent 01917b9f74
commit b77cf42c0b
24 changed files with 46 additions and 46 deletions

View File

@ -246,7 +246,7 @@ class Custom_Background {
<h3><?php _e( 'Background Image' ); ?></h3>
<table class="form-table">
<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><?php _e( 'Preview' ); ?></th>
@ -340,7 +340,7 @@ class Custom_Background {
<h3><?php _e( 'Display Options' ); ?></h3>
<form method="post">
<table class="form-table">
<table class="form-table" role="presentation">
<tbody>
<?php if ( get_background_image() ) : ?>
<input name="background-preset" type="hidden" value="custom">

View File

@ -490,7 +490,7 @@ class Custom_Image_Header {
<h3><?php _e( 'Header Image' ); ?></h3>
<table class="form-table">
<table class="form-table" role="presentation">
<tbody>
<?php if ( get_custom_header() || display_header_text() ) : ?>
@ -628,7 +628,7 @@ class Custom_Image_Header {
<form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ); ?>">
<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
<table class="form-table">
<table class="form-table" role="presentation">
<tbody>
<?php if ( get_uploaded_header_images() ) : ?>
<tr>
@ -689,7 +689,7 @@ class Custom_Image_Header {
<h3><?php _e( 'Header Text' ); ?></h3>
<table class="form-table">
<table class="form-table" role="presentation">
<tbody>
<tr>
<th scope="row"><?php _e( 'Header Text' ); ?></th>

View File

@ -127,7 +127,7 @@ if ( isset( $tag->name ) ) {
$tag_name_value = esc_attr( $tag->name );
}
?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="form-field form-required term-name-wrap">
<th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
<td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" />

View File

@ -802,7 +802,7 @@ function avoid_blog_page_permalink_collision( $data, $postarr ) {
*/
function choose_primary_blog() {
?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<?php /* translators: My sites label */ ?>
<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
@ -914,7 +914,7 @@ function confirm_delete_users( $users ) {
$site_admins = get_super_admins();
$admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>';
?>
<table class="form-table">
<table class="form-table" role="presentation">
<?php
foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
if ( $user_id != '' && $user_id != '0' ) {

View File

@ -223,7 +223,7 @@ function network_step1( $errors = false ) {
<strong><?php _e( 'You cannot change this later.' ); ?></strong></p>
<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
<?php // @todo: Link to an MS readme? ?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
<td>
@ -272,7 +272,7 @@ function network_step1( $errors = false ) {
);
?>
</p>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
<td>
@ -289,7 +289,7 @@ function network_step1( $errors = false ) {
<?php endif; ?>
<h3><?php esc_html_e( 'Network Details' ); ?></h3>
<table class="form-table">
<table class="form-table" role="presentation">
<?php if ( 'localhost' == $hostname ) : ?>
<tr>
<th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th>

View File

@ -1605,7 +1605,7 @@ function do_settings_sections( $page ) {
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
continue;
}
echo '<table class="form-table">';
echo '<table class="form-table" role="presentation">';
do_settings_fields( $page, $section['id'] );
echo '</table>';
}

View File

@ -113,7 +113,7 @@ function display_setup_form( $error = null ) {
<p class="message"><?php echo $error; ?></p>
<?php } ?>
<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th>
<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td>

View File

@ -148,7 +148,7 @@ if ( isset( $_GET['updated'] ) ) {
<form method="post" action="settings.php" novalidate="novalidate">
<?php wp_nonce_field( 'siteoptions' ); ?>
<h2><?php _e( 'Operational Settings' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="site_name"><?php _e( 'Network Title' ); ?></label></th>
<td>
@ -188,7 +188,7 @@ if ( isset( $_GET['updated'] ) ) {
</tr>
</table>
<h2><?php _e( 'Registration Settings' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><?php _e( 'Allow new registrations' ); ?></th>
<?php
@ -277,7 +277,7 @@ if ( isset( $_GET['updated'] ) ) {
</table>
<h2><?php _e( 'New Site Settings' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ); ?></label></th>
@ -358,7 +358,7 @@ if ( isset( $_GET['updated'] ) ) {
</tr>
</table>
<h2><?php _e( 'Upload Settings' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><?php _e( 'Site upload space' ); ?></th>
<td>
@ -402,7 +402,7 @@ if ( isset( $_GET['updated'] ) ) {
if ( ! empty( $languages ) || ! empty( $translations ) ) {
?>
<h2><?php _e( 'Language Settings' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th><label for="WPLANG"><?php _e( 'Default Language' ); ?></label></th>
<td>

View File

@ -152,7 +152,7 @@ if ( ! empty( $messages ) ) {
<form method="post" action="site-info.php?action=update-site">
<?php wp_nonce_field( 'edit-site' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
<table class="form-table">
<table class="form-table" role="presentation">
<?php
// The main site of the network should not be updated on this page.
if ( $is_main_site ) :

View File

@ -224,7 +224,7 @@ printf(
</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">
<table class="form-table" role="presentation">
<tr class="form-field form-required">
<th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ); ?> <span class="required">*</span></label></th>
<td>

View File

@ -111,7 +111,7 @@ if ( ! empty( $messages ) ) {
<form method="post" action="site-settings.php?action=update-site">
<?php wp_nonce_field( 'edit-site' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
<table class="form-table">
<table class="form-table" role="presentation">
<?php
$blog_prefix = $wpdb->get_blog_prefix( $id );
$sql = "SELECT * FROM {$blog_prefix}options

View File

@ -300,7 +300,7 @@ if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_us
<h2 id="add-existing-user"><?php _e( 'Add Existing User' ); ?></h2>
<form action="site-users.php?action=adduser" id="adduser" method="post">
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="newuser"><?php _e( 'Username' ); ?></label></th>
<td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td>
@ -334,7 +334,7 @@ if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_use
<h2 id="add-new-user"><?php _e( 'Add New User' ); ?></h2>
<form action="<?php echo network_admin_url( 'site-users.php?action=newuser' ); ?>" id="newuser" method="post">
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="user_username"><?php _e( 'Username' ); ?></label></th>
<td><input type="text" class="regular-text" name="user[username]" id="user_username" /></td>

View File

@ -120,7 +120,7 @@ if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) {
</div>
<?php } ?>
<form action="<?php echo network_admin_url( 'user-new.php?action=add-user' ); ?>" id="adduser" method="post" novalidate="novalidate">
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="form-field form-required">
<th scope="row"><label for="username"><?php _e( 'Username' ); ?></label></th>
<td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" /></td>

View File

@ -41,7 +41,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
<form method="post" action="options.php">
<?php settings_fields( 'discussion' ); ?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><?php _e( 'Default post settings' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Default post settings' ); ?></span></legend>
@ -218,7 +218,7 @@ if ( ! $show_avatars ) {
}
?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><?php _e( 'Avatar Display' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Avatar Display' ); ?></span></legend>

View File

@ -58,7 +58,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
<form method="post" action="options.php" novalidate="novalidate">
<?php settings_fields( 'general' ); ?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="blogname"><?php _e( 'Site Title' ); ?></label></th>

View File

@ -51,7 +51,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
<h2 class="title"><?php _e( 'Image sizes' ); ?></h2>
<p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><?php _e( 'Thumbnail size' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Thumbnail size' ); ?></span></legend>
@ -98,14 +98,14 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) :
?>
<h2 class="title"><?php _e( 'Embeds' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<?php do_settings_fields( 'media', 'embeds' ); ?>
</table>
<?php endif; ?>
<?php if ( ! is_multisite() ) : ?>
<h2 class="title"><?php _e( 'Uploading Files' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<?php
// If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) :

View File

@ -300,7 +300,7 @@ printf( __( 'If you like, you may enter custom structures for your category and
?>
</p>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e( 'Category base' ); ?></label></th>
<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>

View File

@ -61,7 +61,7 @@ if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', '
<?php if ( ! get_pages() ) : ?>
<input name="show_on_front" type="hidden" value="posts" />
<table class="form-table">
<table class="form-table" role="presentation">
<?php
if ( 'posts' != get_option( 'show_on_front' ) ) :
update_option( 'show_on_front', 'posts' );
@ -72,7 +72,7 @@ else :
update_option( 'show_on_front', 'posts' );
}
?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><?php _e( 'Your homepage displays' ); ?></th>
<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Your homepage displays' ); ?></span></legend>

View File

@ -62,7 +62,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
<form method="post" action="options.php">
<?php settings_fields( 'writing' ); ?>
<table class="form-table">
<table class="form-table" role="presentation">
<?php if ( get_site_option( 'initial_db_version' ) < 32453 ) : ?>
<tr>
<th scope="row"><?php _e( 'Formatting' ); ?></th>
@ -150,7 +150,7 @@ if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
?>
</p>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="mailserver_url"><?php _e( 'Mail Server' ); ?></label></th>
<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option( 'mailserver_url' ); ?>" class="regular-text code" />

View File

@ -320,7 +320,7 @@ include( ABSPATH . 'wp-admin/admin-header.php' ); ?>
<?php wp_nonce_field( 'options-options' ); ?>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="option_page" value="options" />
<table class="form-table">
<table class="form-table" role="presentation">
<?php
$options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" );

View File

@ -207,7 +207,7 @@ switch ( $step ) {
<h1 class="screen-reader-text"><?php _e( 'Set up your database connection' ); ?></h1>
<form method="post" action="setup-config.php?step=2">
<p><?php _e( 'Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host.' ); ?></p>
<table class="form-table">
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th>
<td><input name="dbname" id="dbname" type="text" size="25" value="wordpress"<?php echo $autofocus; ?>/></td>

View File

@ -255,7 +255,7 @@ switch ( $action ) {
<h2><?php _e( 'Personal Options' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
<tr class="user-rich-editing-wrap">
<th scope="row"><?php _e( 'Visual Editor' ); ?></th>
@ -385,7 +385,7 @@ endif;
<h2><?php _e( 'Name' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="user-user-login-wrap">
<th><label for="user_login"><?php _e( 'Username' ); ?></label></th>
<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e( 'Usernames cannot be changed.' ); ?></span></td>
@ -482,7 +482,7 @@ endif; //!IS_PROFILE_PAGE
<h2><?php _e( 'Contact Info' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="user-email-wrap">
<th><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
<td><input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text ltr" />
@ -551,7 +551,7 @@ endif; //!IS_PROFILE_PAGE
<h2><?php IS_PROFILE_PAGE ? _e( 'About Yourself' ) : _e( 'About the user' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="user-description-wrap">
<th><label for="description"><?php _e( 'Biographical Info' ); ?></label></th>
<td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description; // textarea_escaped ?></textarea>
@ -607,7 +607,7 @@ endif; //!IS_PROFILE_PAGE
</table>
<h2><?php _e( 'Account Management' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr id="password" class="user-pass1-wrap">
<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
<td>
@ -728,7 +728,7 @@ endif; //!IS_PROFILE_PAGE
) :
?>
<h2><?php _e( 'Additional Capabilities' ); ?></h2>
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="user-capabilities-wrap">
<th scope="row"><?php _e( 'Capabilities' ); ?></th>
<td>

View File

@ -393,7 +393,7 @@ if ( is_multisite() && current_user_can( 'promote_users' ) ) {
<input name="action" type="hidden" value="adduser" />
<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="form-field form-required">
<th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th>
<td><input name="email" type="<?php echo $type; ?>" id="adduser-email" class="wp-suggest-user" value="" /></td>
@ -462,7 +462,7 @@ if ( current_user_can( 'create_users' ) ) {
$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
?>
<table class="form-table">
<table class="form-table" role="presentation">
<tr class="form-field form-required">
<th scope="row"><label for="user_login"><?php _e( 'Username' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
<td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr( $new_user_login ); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45402';
$wp_version = '5.3-alpha-45403';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.