Skip to content

Commit a3fbc75

Browse files
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
1 parent a4d9f02 commit a3fbc75

23 files changed

+45
-45
lines changed

src/wp-admin/custom-background.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function admin_page() {
246246

247247
<h3><?php _e( 'Background Image' ); ?></h3>
248248

249-
<table class="form-table">
249+
<table class="form-table" role="presentation">
250250
<tbody>
251251
<tr>
252252
<th scope="row"><?php _e( 'Preview' ); ?></th>
@@ -340,7 +340,7 @@ public function admin_page() {
340340

341341
<h3><?php _e( 'Display Options' ); ?></h3>
342342
<form method="post">
343-
<table class="form-table">
343+
<table class="form-table" role="presentation">
344344
<tbody>
345345
<?php if ( get_background_image() ) : ?>
346346
<input name="background-preset" type="hidden" value="custom">

src/wp-admin/custom-header.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ public function step_1() {
490490

491491
<h3><?php _e( 'Header Image' ); ?></h3>
492492

493-
<table class="form-table">
493+
<table class="form-table" role="presentation">
494494
<tbody>
495495

496496
<?php if ( get_custom_header() || display_header_text() ) : ?>
@@ -628,7 +628,7 @@ public function step_1() {
628628

629629
<form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ); ?>">
630630
<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
631-
<table class="form-table">
631+
<table class="form-table" role="presentation">
632632
<tbody>
633633
<?php if ( get_uploaded_header_images() ) : ?>
634634
<tr>
@@ -689,7 +689,7 @@ public function step_1() {
689689

690690
<h3><?php _e( 'Header Text' ); ?></h3>
691691

692-
<table class="form-table">
692+
<table class="form-table" role="presentation">
693693
<tbody>
694694
<tr>
695695
<th scope="row"><?php _e( 'Header Text' ); ?></th>

src/wp-admin/edit-tag-form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
$tag_name_value = esc_attr( $tag->name );
128128
}
129129
?>
130-
<table class="form-table">
130+
<table class="form-table" role="presentation">
131131
<tr class="form-field form-required term-name-wrap">
132132
<th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
133133
<td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" />

src/wp-admin/includes/ms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ function avoid_blog_page_permalink_collision( $data, $postarr ) {
802802
*/
803803
function choose_primary_blog() {
804804
?>
805-
<table class="form-table">
805+
<table class="form-table" role="presentation">
806806
<tr>
807807
<?php /* translators: My sites label */ ?>
808808
<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
@@ -914,7 +914,7 @@ function confirm_delete_users( $users ) {
914914
$site_admins = get_super_admins();
915915
$admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>';
916916
?>
917-
<table class="form-table">
917+
<table class="form-table" role="presentation">
918918
<?php
919919
foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
920920
if ( $user_id != '' && $user_id != '0' ) {

src/wp-admin/includes/network.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function network_step1( $errors = false ) {
223223
<strong><?php _e( 'You cannot change this later.' ); ?></strong></p>
224224
<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
225225
<?php // @todo: Link to an MS readme? ?>
226-
<table class="form-table">
226+
<table class="form-table" role="presentation">
227227
<tr>
228228
<th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
229229
<td>
@@ -272,7 +272,7 @@ function network_step1( $errors = false ) {
272272
);
273273
?>
274274
</p>
275-
<table class="form-table">
275+
<table class="form-table" role="presentation">
276276
<tr>
277277
<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
278278
<td>
@@ -289,7 +289,7 @@ function network_step1( $errors = false ) {
289289
<?php endif; ?>
290290

291291
<h3><?php esc_html_e( 'Network Details' ); ?></h3>
292-
<table class="form-table">
292+
<table class="form-table" role="presentation">
293293
<?php if ( 'localhost' == $hostname ) : ?>
294294
<tr>
295295
<th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th>

src/wp-admin/includes/template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ function do_settings_sections( $page ) {
16051605
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
16061606
continue;
16071607
}
1608-
echo '<table class="form-table">';
1608+
echo '<table class="form-table" role="presentation">';
16091609
do_settings_fields( $page, $section['id'] );
16101610
echo '</table>';
16111611
}

src/wp-admin/install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function display_setup_form( $error = null ) {
113113
<p class="message"><?php echo $error; ?></p>
114114
<?php } ?>
115115
<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
116-
<table class="form-table">
116+
<table class="form-table" role="presentation">
117117
<tr>
118118
<th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th>
119119
<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td>

src/wp-admin/network/settings.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
<form method="post" action="settings.php" novalidate="novalidate">
149149
<?php wp_nonce_field( 'siteoptions' ); ?>
150150
<h2><?php _e( 'Operational Settings' ); ?></h2>
151-
<table class="form-table">
151+
<table class="form-table" role="presentation">
152152
<tr>
153153
<th scope="row"><label for="site_name"><?php _e( 'Network Title' ); ?></label></th>
154154
<td>
@@ -188,7 +188,7 @@
188188
</tr>
189189
</table>
190190
<h2><?php _e( 'Registration Settings' ); ?></h2>
191-
<table class="form-table">
191+
<table class="form-table" role="presentation">
192192
<tr>
193193
<th scope="row"><?php _e( 'Allow new registrations' ); ?></th>
194194
<?php
@@ -277,7 +277,7 @@
277277

278278
</table>
279279
<h2><?php _e( 'New Site Settings' ); ?></h2>
280-
<table class="form-table">
280+
<table class="form-table" role="presentation">
281281

282282
<tr>
283283
<th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ); ?></label></th>
@@ -358,7 +358,7 @@
358358
</tr>
359359
</table>
360360
<h2><?php _e( 'Upload Settings' ); ?></h2>
361-
<table class="form-table">
361+
<table class="form-table" role="presentation">
362362
<tr>
363363
<th scope="row"><?php _e( 'Site upload space' ); ?></th>
364364
<td>
@@ -402,7 +402,7 @@
402402
if ( ! empty( $languages ) || ! empty( $translations ) ) {
403403
?>
404404
<h2><?php _e( 'Language Settings' ); ?></h2>
405-
<table class="form-table">
405+
<table class="form-table" role="presentation">
406406
<tr>
407407
<th><label for="WPLANG"><?php _e( 'Default Language' ); ?></label></th>
408408
<td>

src/wp-admin/network/site-info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<form method="post" action="site-info.php?action=update-site">
153153
<?php wp_nonce_field( 'edit-site' ); ?>
154154
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
155-
<table class="form-table">
155+
<table class="form-table" role="presentation">
156156
<?php
157157
// The main site of the network should not be updated on this page.
158158
if ( $is_main_site ) :

src/wp-admin/network/site-new.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
</p>
225225
<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate">
226226
<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?>
227-
<table class="form-table">
227+
<table class="form-table" role="presentation">
228228
<tr class="form-field form-required">
229229
<th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ); ?> <span class="required">*</span></label></th>
230230
<td>

0 commit comments

Comments
 (0)