Make WordPress Core

Ticket #59353: 59353.diff

File 59353.diff, 741 bytes (added by joedolson, 2 years ago)

Fix focus loss

  • src/js/_enqueues/lib/image-edit.js

     
    236236                // Open menu and set z-index to appear above image crop area if it is enabled.
    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;
    243245        },