Skip to content

Commit 19faad7

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@58161 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 23a455e commit 19faad7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wp-admin/includes/plugin-install.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
943943
$all_plugin_dependencies_active = $active_plugin_dependencies_count === $plugin_dependencies_count;
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'] ),
949949
/* translators: %s: Plugin name and version. */
@@ -958,7 +958,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
958958
if ( $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'] ),
964964
/* translators: %s: Plugin name and version. */
@@ -979,7 +979,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
979979
if ( $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 ),
985985
esc_url( $status['url'] ),
@@ -1026,7 +1026,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
10261026
}
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 ),
10321032
esc_attr( $data->slug ),

0 commit comments

Comments
 (0)