Make WordPress Core

Changeset 58161


Ignore:
Timestamp:
05/16/2024 03:29:57 PM (4 weeks ago)
Author:
jorbin
Message:

Plugins: Assign role of button to links that act as buttons.

Clicking on these links initiates an action, so they are more semantically a button rather than a link. Keeping them as an anchor in html allows any existing JS that is targeted to these items to continue to function. The addition of the role helps assistive technology to know that they should treat this as a button.

Props stevejonesdev, sabernhardt, vipulgupta003, rcreators, joedolson.
Fixes #61011.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin-install.php

    r58146 r58161  
    944944
    945945    sprintf(
    946         '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
     946        '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s" role="button">%s</a>',
    947947        esc_attr( $data->slug ),
    948948        esc_url( $status['url'] ),
     
    959959                    if ( $compatible_php && $compatible_wp && $all_plugin_dependencies_installed && ! empty( $data->download_link ) ) {
    960960                        $button = sprintf(
    961                             '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
     961                            '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s" role="button">%s</a>',
    962962                            esc_attr( $data->slug ),
    963963                            esc_url( $status['url'] ),
     
    980980                    if ( $compatible_php && $compatible_wp ) {
    981981                        $button = sprintf(
    982                             '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
     982                            '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s" role="button">%s</a>',
    983983                            esc_attr( $status['file'] ),
    984984                            esc_attr( $data->slug ),
     
    10271027
    10281028                        $button = sprintf(
    1029                             '<a href="%1$s" data-name="%2$s" data-slug="%3$s" data-plugin="%4$s" class="button button-primary activate-now" aria-label="%5$s">%6$s</a>',
     1029                            '<a href="%1$s" data-name="%2$s" data-slug="%3$s" data-plugin="%4$s" class="button button-primary activate-now" aria-label="%5$s" role="button">%6$s</a>',
    10301030                            esc_url( $activate_url ),
    10311031                            esc_attr( $name ),
Note: See TracChangeset for help on using the changeset viewer.