Make WordPress Core

Changeset 56591


Ignore:
Timestamp:
09/14/2023 10:33:50 PM (12 months ago)
Author:
joedolson
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/image-edit.js

    r55935 r56591  
    237237        $target
    238238            .toggleClass( 'imgedit-popup-menu-open' ).slideToggle( 'fast' ).css( { 'z-index' : 200000 } );
    239         // Move focus to first item in menu.
    240         $target.find( 'button' ).first().trigger( 'focus' );
     239        // Move focus to first item in menu when opening menu.
     240        if ( 'true' === $el.attr( 'aria-expanded' ) ) {
     241            $target.find( 'button' ).first().trigger( 'focus' );
     242        }
    241243
    242244        return false;
Note: See TracChangeset for help on using the changeset viewer.