Make WordPress Core

Changeset 59675


Ignore:
Timestamp:
01/21/2025 09:47:27 PM (3 weeks ago)
Author:
audrasjb
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php

    r59554 r59675  
    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. */
     
    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                );
     
    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. */
     
    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        );
     
    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>
     
    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. */
     
    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                );
  • trunk/src/wp-admin/includes/class-wp-themes-list-table.php

    r58745 r59675  
    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. */
Note: See TracChangeset for help on using the changeset viewer.