Changeset 55326
- Timestamp:
- 02/14/2023 12:36:32 AM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/common.js
r54392 r55326 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( e ) { 1707 var focusIsInToggle, focusIsInSidebar; 1708 1709 if ( ! $wpwrap.hasClass( 'wp-responsive-open' ) || ! document.hasFocus() ) { 1710 return; 1711 } 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 1717 if ( ! focusIsInToggle && ! focusIsInSidebar ) { 1718 $( '#wp-admin-bar-menu-toggle' ).trigger( 'click.wp-responsive' ); 1719 } 1720 }, 10 ); 1721 } ); 1722 1723 1705 1724 // Add menu events. 1706 1725 $adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) { … … 1710 1729 1711 1730 $( this ).parent( 'li' ).toggleClass( 'selected' ); 1731 $( this ).trigger( 'focus' ); 1712 1732 event.preventDefault(); 1713 1733 });
Note: See TracChangeset
for help on using the changeset viewer.