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".

Props afercia.
Merges [46748] to the 5.3 branch.
Fixes #48355.
Built from https://develop.svn.wordpress.org/branches/5.3@46778


git-svn-id: http://core.svn.wordpress.org/branches/5.3@46578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-11-25 11:20:02 +00:00
parent 159068b2a0
commit c54903a12e
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.
} else if ( $setting.hasClass('button-group') ) {
$buttons = $setting.find('button').removeClass('active');
$buttons.filter( '[value="' + value + '"]' ).addClass('active');
$buttons = $setting.find( 'button' )
.removeClass( 'active' )
.attr( 'aria-pressed', 'false' );
$buttons.filter( '[value="' + value + '"]' )
.addClass( 'active' )
.attr( 'aria-pressed', 'true' );
// Handle text inputs and textareas.
} 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
*/
$wp_version = '5.3.1-alpha-46777';
$wp_version = '5.3.1-alpha-46778';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.