Media: Fix focus loss when closing Image Rotation menu.

Only shift focus into menu when opening the menu. Check `aria-expanded` value of toggle before moving focus.

Props joedolson.
Fixes #59353.
Built from https://develop.svn.wordpress.org/trunk@56591


git-svn-id: http://core.svn.wordpress.org/trunk@56103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2023-09-14 22:35:16 +00:00
parent e012f30025
commit 5f21a9dafd
3 changed files with 6 additions and 4 deletions

View File

@ -236,8 +236,10 @@
// Open menu and set z-index to appear above image crop area if it is enabled.
$target
.toggleClass( 'imgedit-popup-menu-open' ).slideToggle( 'fast' ).css( { 'z-index' : 200000 } );
// Move focus to first item in menu.
$target.find( 'button' ).first().trigger( 'focus' );
// Move focus to first item in menu when opening menu.
if ( 'true' === $el.attr( 'aria-expanded' ) ) {
$target.find( 'button' ).first().trigger( 'focus' );
}
return false;
},

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56590';
$wp_version = '6.4-alpha-56591';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.