Accessibility: Media: Add an `aria-pressed` attribute to active button within a button group.

The `aria-pressed` attribute communicates semantically the "active" state of buttons that otherwise only look "active".

Fixes #48355.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2019-11-18 22:23:03 +00:00
parent 06ab7e3f6b
commit c0950c1d50
3 changed files with 8 additions and 4 deletions

View File

@ -8758,8 +8758,12 @@ Settings = View.extend(/** @lends wp.media.view.Settings.prototype */{
// Handle button groups. // Handle button groups.
} else if ( $setting.hasClass('button-group') ) { } else if ( $setting.hasClass('button-group') ) {
$buttons = $setting.find('button').removeClass('active'); $buttons = $setting.find( 'button' )
$buttons.filter( '[value="' + value + '"]' ).addClass('active'); .removeClass( 'active' )
.attr( 'aria-pressed', 'false' );
$buttons.filter( '[value="' + value + '"]' )
.addClass( 'active' )
.attr( 'aria-pressed', 'true' );
// Handle text inputs and textareas. // Handle text inputs and textareas.
} else if ( $setting.is('input[type="text"], textarea') ) { } else if ( $setting.is('input[type="text"], textarea') ) {

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-46747'; $wp_version = '5.4-alpha-46748';
/** /**
* 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.