WordPress.org

Make WordPress Core

Changeset 33056


Ignore:
Timestamp:
07/03/2015 03:28:15 AM (5 years ago)
Author:
helen
Message:

Toolbar: Allow submenus to be closed with a second tap on touch devices.

Also closes submenus when the admin menu is toggled open, as it opens below and thus can be obscured.

props stephdau, seanchayes.
see #29906.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/admin-menu.css

    r32946 r33056  
    921921        box-sizing: border-box;
    922922    }
     923
     924    .wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
     925        color: #00b9eb;
     926    }
    923927}
    924928
  • trunk/src/wp-admin/js/common.js

    r33016 r33056  
    753753            $( '#wp-admin-bar-menu-toggle' ).on( 'click.wp-responsive', function( event ) {
    754754                event.preventDefault();
     755
     756                // close any open toolbar submenus
     757                $adminbar.find( '.hover' ).removeClass( 'hover' );
     758
    755759                $wpwrap.toggleClass( 'wp-responsive-open' );
    756760                if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) {
  • trunk/src/wp-includes/css/admin-bar.css

    r32750 r33056  
    208208}
    209209
    210 #wpadminbar .ab-top-menu > li > .ab-item:focus,
     210#wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus,
    211211#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
    212 #wpadminbar .ab-top-menu > li:hover > .ab-item,
     212#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item,
    213213#wpadminbar .ab-top-menu > li.hover > .ab-item {
    214214    background: #32373c;
     
    216216}
    217217
    218 #wpadminbar > #wp-toolbar li:hover span.ab-label,
     218#wpadminbar:not(.mobile) > #wp-toolbar li:hover span.ab-label,
    219219#wpadminbar > #wp-toolbar li.hover span.ab-label,
    220 #wpadminbar > #wp-toolbar a:focus span.ab-label {
     220#wpadminbar:not(.mobile) > #wp-toolbar a:focus span.ab-label {
    221221    color: #00b9eb;
    222222}
     
    285285#wpadminbar li:hover #adminbarsearch:before,
    286286#wpadminbar li #adminbarsearch.adminbar-focused:before {
     287    color: #00b9eb;
     288}
     289
     290#wpadminbar.mobile .quicklinks .ab-icon:before,
     291#wpadminbar.mobile .quicklinks .ab-item:before {
     292    color: #b4b9be;
     293}
     294
     295#wpadminbar.mobile .quicklinks .hover .ab-icon:before,
     296#wpadminbar.mobile .quicklinks .hover .ab-item:before {
    287297    color: #00b9eb;
    288298}
  • trunk/src/wp-includes/js/admin-bar.js

    r32074 r33056  
    2929                    e.preventDefault();
    3030                    el.addClass('hover');
     31                } else if ( ! $( e.target ).closest( 'div' ).hasClass( 'ab-sub-wrapper' ) ) {
     32                    // We're dealing with an already-touch-opened menu genericon (we know el.hasClass('hover')),
     33                    // so close it on a second tap and prevent propag and defaults. See #29906
     34                    e.stopPropagation();
     35                    e.preventDefault();
     36                    el.removeClass('hover');
    3137                }
    3238
     
    125131
    126132        $('#wpadminbar').click( function(e) {
    127             if ( e.target.id != 'wpadminbar' && e.target.id != 'wp-admin-bar-top-secondary' )
    128                 return;
     133            if ( e.target.id != 'wpadminbar' && e.target.id != 'wp-admin-bar-top-secondary' ) {
     134                return;
     135            } else {
     136                adminbar.find( 'li.menupop.hover' ).removeClass( 'hover' );
     137                e.stopPropagation();
     138                return;
     139            }
    129140
    130141            e.preventDefault();
Note: See TracChangeset for help on using the changeset viewer.