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.

git-svn-id: https://develop.svn.wordpress.org/trunk@45403 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2019-05-24 21:55:21 +00:00
parent a4d9f02eef
commit a3fbc75237
23 changed files with 45 additions and 45 deletions

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>