Skip to content

Commit 61b7b97

Browse files
committed
Themes: Remove title attributes from theme list tables.
This changeset updates the old list tables for themes and theme installation to remove `title` attributes or replace them with a more acessible implementation: - Removes `title` attributes from `span` elements - Replaces `title` with `aria-label` for links whose visible text starts with the same word, consistently with links on the "Add Plugins" screen - Reuses the `$preview_title` variable to keep ARIA labels consistent for both Preview links Follow-up to [22439], [27548], [31513], [32991], [50804], [53414]. Props karlgroves, sabernhardt, audrasjb, alh0319. Fixes #62834. See #24766. git-svn-id: https://develop.svn.wordpress.org/trunk@59675 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 396f6fb commit 61b7b97

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/wp-admin/includes/class-wp-theme-install-list-table.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public function single_row( $theme ) {
315315
switch ( $status ) {
316316
case 'update_available':
317317
$actions[] = sprintf(
318-
'<a class="install-now" href="%s" title="%s">%s</a>',
318+
'<a class="install-now" href="%s" aria-label="%s">%s</a>',
319319
esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
320320
/* translators: %s: Theme version. */
321321
esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
@@ -325,15 +325,14 @@ public function single_row( $theme ) {
325325
case 'newer_installed':
326326
case 'latest_installed':
327327
$actions[] = sprintf(
328-
'<span class="install-now" title="%s">%s</span>',
329-
esc_attr__( 'This theme is already installed and is up to date' ),
328+
'<span class="install-now">%s</span>',
330329
_x( 'Installed', 'theme' )
331330
);
332331
break;
333332
case 'install':
334333
default:
335334
$actions[] = sprintf(
336-
'<a class="install-now" href="%s" title="%s">%s</a>',
335+
'<a class="install-now" href="%s" aria-label="%s">%s</a>',
337336
esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
338337
/* translators: %s: Theme name. */
339338
esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
@@ -343,10 +342,9 @@ public function single_row( $theme ) {
343342
}
344343

345344
$actions[] = sprintf(
346-
'<a class="install-theme-preview" href="%s" title="%s">%s</a>',
345+
'<a class="install-theme-preview" href="%s" aria-label="%s">%s</a>',
347346
esc_url( $preview_url ),
348-
/* translators: %s: Theme name. */
349-
esc_attr( sprintf( __( 'Preview %s' ), $name ) ),
347+
esc_attr( $preview_title ),
350348
__( 'Preview' )
351349
);
352350

@@ -363,7 +361,7 @@ public function single_row( $theme ) {
363361
$actions = apply_filters( 'theme_install_actions', $actions, $theme );
364362

365363
?>
366-
<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
364+
<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" aria-label="<?php echo esc_attr( $preview_title ); ?>">
367365
<img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" />
368366
</a>
369367

@@ -474,7 +472,7 @@ public function install_theme_info( $theme ) {
474472
switch ( $status ) {
475473
case 'update_available':
476474
printf(
477-
'<a class="theme-install button button-primary" href="%s" title="%s">%s</a>',
475+
'<a class="theme-install button button-primary" href="%s" aria-label="%s">%s</a>',
478476
esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
479477
/* translators: %s: Theme version. */
480478
esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
@@ -484,8 +482,7 @@ public function install_theme_info( $theme ) {
484482
case 'newer_installed':
485483
case 'latest_installed':
486484
printf(
487-
'<span class="theme-install" title="%s">%s</span>',
488-
esc_attr__( 'This theme is already installed and is up to date' ),
485+
'<span class="theme-install">%s</span>',
489486
_x( 'Installed', 'theme' )
490487
);
491488
break;

src/wp-admin/includes/class-wp-themes-list-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function display_rows() {
211211

212212
$actions = array();
213213
$actions['activate'] = sprintf(
214-
'<a href="%s" class="activatelink" title="%s">%s</a>',
214+
'<a href="%s" class="activatelink" aria-label="%s">%s</a>',
215215
$activate_link,
216216
/* translators: %s: Theme name. */
217217
esc_attr( sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $title ) ),

0 commit comments

Comments
 (0)