Make WordPress Core

Ticket #53587: 53587.3.patch

File 53587.3.patch, 1.3 KB (added by joedolson, 2 years ago)

Remove console.log

  • src/js/_enqueues/admin/common.js

     
    17021702                                }
    17031703                        } );
    17041704
     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
    17051724                        // Add menu events.
    17061725                        $adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
    17071726                                if ( ! $adminmenu.data('wp-responsive') ) {
     
    17091728                                }
    17101729
    17111730                                $( this ).parent( 'li' ).toggleClass( 'selected' );
     1731                                $( this ).trigger( 'focus' );
    17121732                                event.preventDefault();
    17131733                        });
    17141734