Editor: Add a role `button` to the Tags meta box tag cloud links.

For better accessibility, the tag cloud links in the Tags meta box should be
reported to assistive technologies as buttons. They don't navigate to a new
resource, instead they perform an action.

Fixes #38318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2016-10-16 20:09:28 +00:00
parent 8aef143d80
commit 7be7d396f1
2 changed files with 3 additions and 2 deletions

View File

@ -917,6 +917,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
$tags_data[] = array( $tags_data[] = array(
'id' => $tag_id, 'id' => $tag_id,
'url' => '#' != $tag->link ? $tag->link : '#', 'url' => '#' != $tag->link ? $tag->link : '#',
'role' => '#' != $tag->link ? '' : ' role="button"',
'name' => $tag->name, 'name' => $tag->name,
'title' => $title, 'title' => $title,
'slug' => $tag->slug, 'slug' => $tag->slug,
@ -940,7 +941,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
// generate the output links array // generate the output links array
foreach ( $tags_data as $key => $tag_data ) { foreach ( $tags_data as $key => $tag_data ) {
$class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 ); $class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 );
$a[] = "<a href='" . esc_url( $tag_data['url'] ) . "' class='" . esc_attr( $class ) . "' title='" . esc_attr( $tag_data['title'] ) . "' style='font-size: " . esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ) . ";'>" . esc_html( $tag_data['name'] ) . "</a>"; $a[] = "<a href='" . esc_url( $tag_data['url'] ) . "'" . $tag_data['role'] . " class='" . esc_attr( $class ) . "' title='" . esc_attr( $tag_data['title'] ) . "' style='font-size: " . esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ) . ";'>" . esc_html( $tag_data['name'] ) . "</a>";
} }
switch ( $args['format'] ) { switch ( $args['format'] ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-alpha-38799'; $wp_version = '4.7-alpha-38800';
/** /**
* 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.