Ticket #58912: 58912.2.diff
File 58912.2.diff, 1.4 KB (added by , 16 months ago) |
---|
-
src/js/_enqueues/admin/common.js
1702 1702 } 1703 1703 } ); 1704 1704 1705 // Close sidebar when focus moves outside of toggle and sidebar. 1706 $( '#wp-admin-bar-menu-toggle, #adminmenumain' ).on( 'focusout', function() { 1707 var focusIsInToggle, focusIsInSidebar; 1705 // Close sidebar when target moves outside of toggle and sidebar. 1706 $( document ).on( 'click', function(e) { 1708 1707 1709 1708 if ( ! $wpwrap.hasClass( 'wp-responsive-open' ) || ! document.hasFocus() ) { 1710 1709 return; 1711 1710 } 1712 // A brief delay is required to allow focus to switch to another element.1713 setTimeout( function() {1714 focusIsInToggle = $.contains( $( '#wp-admin-bar-menu-toggle' )[0], $( ':focus' )[0] );1715 focusIsInSidebar = $.contains( $( '#adminmenumain' )[0], $( ':focus' )[0] );1716 1711 1717 if ( ! focusIsInToggle && ! focusIsInSidebar ) { 1718 $( '#wp-admin-bar-menu-toggle' ).trigger( 'click.wp-responsive' ); 1719 } 1720 }, 10 ); 1712 var focusIsInToggle = $.contains( $( '#wp-admin-bar-menu-toggle' )[0], e.target ); 1713 var focusIsInSidebar = $.contains( $( '#adminmenumain' )[0], e.target ); 1714 1715 if ( ! focusIsInToggle && ! focusIsInSidebar ) { 1716 $( '#wp-admin-bar-menu-toggle' ).trigger( 'click.wp-responsive' ); 1717 } 1721 1718 } ); 1722 1719 1723 1720