Make the responsive menu usable with a mouse, fix non-folded and :focus styles, toggle the submenus on touchend/click. Fixes #26086.
Built from https://develop.svn.wordpress.org/trunk@26516 git-svn-id: http://core.svn.wordpress.org/trunk@26409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f1f6cec5e8
commit
830bcf9957
|
@ -11823,6 +11823,14 @@ li#wp-admin-bar-menu-toggle {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
|
||||||
|
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
|
||||||
|
position: relative;
|
||||||
|
right: -1px;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove submenu headers and adjust sub meu*/
|
/* Remove submenu headers and adjust sub meu*/
|
||||||
#adminmenu .wp-submenu .wp-submenu-head {
|
#adminmenu .wp-submenu .wp-submenu-head {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11823,6 +11823,14 @@ li#wp-admin-bar-menu-toggle {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
|
||||||
|
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
|
||||||
|
position: relative;
|
||||||
|
left: -1px;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove submenu headers and adjust sub meu*/
|
/* Remove submenu headers and adjust sub meu*/
|
||||||
#adminmenu .wp-submenu .wp-submenu-head {
|
#adminmenu .wp-submenu .wp-submenu-head {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -251,6 +251,11 @@ $(document).ready( function() {
|
||||||
if ( isNaN(top) || top > -5 ) // meaning the submenu is visible
|
if ( isNaN(top) || top > -5 ) // meaning the submenu is visible
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( menu.data('wp-responsive') ) {
|
||||||
|
// The menu is in responsive mode, bail
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
menutop = $(this).offset().top;
|
menutop = $(this).offset().top;
|
||||||
wintop = $(window).scrollTop();
|
wintop = $(window).scrollTop();
|
||||||
maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
|
maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
|
||||||
|
@ -275,6 +280,11 @@ $(document).ready( function() {
|
||||||
$(this).addClass('opensub');
|
$(this).addClass('opensub');
|
||||||
},
|
},
|
||||||
out: function(){
|
out: function(){
|
||||||
|
if ( menu.data('wp-responsive') ) {
|
||||||
|
// The menu is in responsive mode, bail
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$(this).removeClass('opensub').find('.wp-submenu').css('margin-top', '');
|
$(this).removeClass('opensub').find('.wp-submenu').css('margin-top', '');
|
||||||
},
|
},
|
||||||
timeout: 200,
|
timeout: 200,
|
||||||
|
@ -283,8 +293,18 @@ $(document).ready( function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.on('focus.adminmenu', '.wp-submenu a', function(e){
|
menu.on('focus.adminmenu', '.wp-submenu a', function(e){
|
||||||
|
if ( menu.data('wp-responsive') ) {
|
||||||
|
// The menu is in responsive mode, bail
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$(e.target).closest('li.menu-top').addClass('opensub');
|
$(e.target).closest('li.menu-top').addClass('opensub');
|
||||||
}).on('blur.adminmenu', '.wp-submenu a', function(e){
|
}).on('blur.adminmenu', '.wp-submenu a', function(e){
|
||||||
|
if ( menu.data('wp-responsive') ) {
|
||||||
|
// The menu is in responsive mode, bail
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$(e.target).closest('li.menu-top').removeClass('opensub');
|
$(e.target).closest('li.menu-top').removeClass('opensub');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -541,18 +561,28 @@ $(document).ready( function() {
|
||||||
// Add menu events
|
// Add menu events
|
||||||
$adminmenu.on( 'touchstart.wp-responsive', 'li.wp-has-submenu > a', function() {
|
$adminmenu.on( 'touchstart.wp-responsive', 'li.wp-has-submenu > a', function() {
|
||||||
scrollStart = $window.scrollTop();
|
scrollStart = $window.scrollTop();
|
||||||
}).on( 'touchend.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
|
}).on( 'touchend.wp-responsive click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
|
||||||
if ( ! $adminmenu.data('wp-responsive') || $window.scrollTop() !== scrollStart ) {
|
if ( ! $adminmenu.data('wp-responsive') ||
|
||||||
|
( event.type === 'touchend' && $window.scrollTop() !== scrollStart ) ) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$( this ).find( 'li.wp-has-submenu' ).removeClass( 'selected' );
|
$( this ).parent( 'li' ).toggleClass( 'selected' );
|
||||||
$( this ).parent( 'li' ).addClass( 'selected' );
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
self.trigger();
|
self.trigger();
|
||||||
$document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) );
|
$document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) );
|
||||||
|
|
||||||
|
// This needs to run later as UI Sortable may be initialized later on $(document).ready()
|
||||||
|
$window.on( 'load.wp-responsive', function() {
|
||||||
|
var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth;
|
||||||
|
|
||||||
|
if ( width <= 782 ) {
|
||||||
|
self.disableSortables();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate: function() {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue