[wp-trac] [WordPress Trac] #54837: Mobile admin menu: Clicking on menu items hides the menu

WordPress Trac noreply at wordpress.org
Mon Jan 17 06:26:53 UTC 2022


#54837: Mobile admin menu: Clicking on menu items hides the menu
--------------------------------------------+---------------------
 Reporter:  dhusakovic                      |       Owner:  (none)
     Type:  defect (bug)                    |      Status:  new
 Priority:  normal                          |   Milestone:  5.9
Component:  Administration                  |     Version:  trunk
 Severity:  normal                          |  Resolution:
 Keywords:  needs-testing has-testing-info  |     Focuses:  ui
--------------------------------------------+---------------------

Comment (by costdev):

 Thanks @thelovekesh!

 If you're comfortable editing code, please do the following:

 1. Add the following to `wp-config.php`:
 {{{
 define( 'SCRIPT_DEBUG', true );
 }}}

 2. Open `wp-admin/js/common.js`.
 3. Search for `Close sidebar`. This should bring you to the following
 block of code:
 {{{
 // Close sidebar when focus moves outside of toggle and sidebar.
 $( '#wp-admin-bar-menu-toggle, #adminmenumain' ).on( 'focusout',
 function() {
     var focusIsInToggle, focusIsInSidebar;

     if ( ! $wpwrap.hasClass( 'wp-responsive-open' ) ) {
         return;
     }

     // A brief delay is required to allow focus to switch to another
 element.
     setTimeout( function() {
         focusIsInToggle  = $.contains( $( '#wp-admin-bar-menu-toggle'
 )[0], $( ':focus' )[0] );
         focusIsInSidebar = $.contains( $( '#adminmenumain' )[0], $(
 ':focus' )[0] );

         if ( ! focusIsInToggle && ! focusIsInSidebar ) {
             $( '#wp-admin-bar-menu-toggle' ).trigger( 'click.wp-
 responsive' );
         }
     }, 10 );
 } );
 }}}

 4. Delete this block of code and save the file.
 5. Perform a hard refresh (`Cmd`+`R` or `Ctrl` + `F5` depending on your
 device).
 6. Let us know if you are still able to reproduce the issue.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54837#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list