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.



Built from https://develop.svn.wordpress.org/trunk@59675


git-svn-id: http://core.svn.wordpress.org/trunk@59018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2025-01-21 21:49:22 +00:00
parent 091d5e460e
commit 37e2744105
3 changed files with 10 additions and 13 deletions

View File

@ -315,7 +315,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
switch ( $status ) { switch ( $status ) {
case 'update_available': case 'update_available':
$actions[] = sprintf( $actions[] = sprintf(
'<a class="install-now" href="%s" title="%s">%s</a>', '<a class="install-now" href="%s" aria-label="%s">%s</a>',
esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
/* translators: %s: Theme version. */ /* translators: %s: Theme version. */
esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
@ -325,15 +325,14 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
case 'newer_installed': case 'newer_installed':
case 'latest_installed': case 'latest_installed':
$actions[] = sprintf( $actions[] = sprintf(
'<span class="install-now" title="%s">%s</span>', '<span class="install-now">%s</span>',
esc_attr__( 'This theme is already installed and is up to date' ),
_x( 'Installed', 'theme' ) _x( 'Installed', 'theme' )
); );
break; break;
case 'install': case 'install':
default: default:
$actions[] = sprintf( $actions[] = sprintf(
'<a class="install-now" href="%s" title="%s">%s</a>', '<a class="install-now" href="%s" aria-label="%s">%s</a>',
esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ), esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
@ -343,10 +342,9 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
} }
$actions[] = sprintf( $actions[] = sprintf(
'<a class="install-theme-preview" href="%s" title="%s">%s</a>', '<a class="install-theme-preview" href="%s" aria-label="%s">%s</a>',
esc_url( $preview_url ), esc_url( $preview_url ),
/* translators: %s: Theme name. */ esc_attr( $preview_title ),
esc_attr( sprintf( __( 'Preview %s' ), $name ) ),
__( 'Preview' ) __( 'Preview' )
); );
@ -363,7 +361,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
$actions = apply_filters( 'theme_install_actions', $actions, $theme ); $actions = apply_filters( 'theme_install_actions', $actions, $theme );
?> ?>
<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>"> <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" aria-label="<?php echo esc_attr( $preview_title ); ?>">
<img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" /> <img src="<?php echo esc_url( $theme->screenshot_url . '?ver=' . $theme->version ); ?>" width="150" alt="" />
</a> </a>
@ -474,7 +472,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
switch ( $status ) { switch ( $status ) {
case 'update_available': case 'update_available':
printf( printf(
'<a class="theme-install button button-primary" href="%s" title="%s">%s</a>', '<a class="theme-install button button-primary" href="%s" aria-label="%s">%s</a>',
esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ), esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
/* translators: %s: Theme version. */ /* translators: %s: Theme version. */
esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ), esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
@ -484,8 +482,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
case 'newer_installed': case 'newer_installed':
case 'latest_installed': case 'latest_installed':
printf( printf(
'<span class="theme-install" title="%s">%s</span>', '<span class="theme-install">%s</span>',
esc_attr__( 'This theme is already installed and is up to date' ),
_x( 'Installed', 'theme' ) _x( 'Installed', 'theme' )
); );
break; break;

View File

@ -211,7 +211,7 @@ class WP_Themes_List_Table extends WP_List_Table {
$actions = array(); $actions = array();
$actions['activate'] = sprintf( $actions['activate'] = sprintf(
'<a href="%s" class="activatelink" title="%s">%s</a>', '<a href="%s" class="activatelink" aria-label="%s">%s</a>',
$activate_link, $activate_link,
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
esc_attr( sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $title ) ), esc_attr( sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $title ) ),

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.8-alpha-59674'; $wp_version = '6.8-alpha-59675';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.