Skip to content
Closed

Pr/11902 #15827

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/js/_enqueues/admin/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1825,16 +1825,34 @@ $( function() {

// Add menu events.
$adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
var $link, $menuItem, state;

if ( ! $adminmenu.data('wp-responsive') ) {
return;
}
let state = ( 'false' === $( this ).attr( 'aria-expanded' ) ) ? 'true' : 'false';
$( this ).parent( 'li' ).toggleClass( 'selected' );
$( this ).attr( 'aria-expanded', state );
$( this ).trigger( 'focus' );

$link = $( this );
$menuItem = $link.parent( 'li' );
state = ( 'false' === $link.attr( 'aria-expanded' ) ) ? 'true' : 'false';

$adminmenu.find( 'li.selected' ).not( $menuItem ).removeClass( 'selected' )
.children( 'a' ).attr( 'aria-expanded', 'false' );

$menuItem.toggleClass( 'selected' );
$link.attr( 'aria-expanded', state );
$link.trigger( 'focus' );
event.preventDefault();
});

$adminmenu.on( 'click.wp-responsive', '.wp-submenu a', function() {
if ( ! $adminmenu.data( 'wp-responsive' ) ) {
return;
}

$adminmenu.find( 'li.selected' ).removeClass( 'selected' )
.children( 'a' ).attr( 'aria-expanded', 'false' );
});

self.trigger();
$document.on( 'wp-window-resized.wp-responsive', this.trigger.bind( this ) );

Expand Down Expand Up @@ -1885,6 +1903,8 @@ $( function() {
}

$adminmenu.data( 'wp-responsive', 1 );
$adminmenu.find( 'li.selected' ).not( '.wp-has-current-submenu' ).removeClass( 'selected' )
.children( 'a' ).attr( 'aria-expanded', 'false' );
this.disableSortables();
},

Expand Down
12 changes: 6 additions & 6 deletions src/wp-admin/css/admin-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@
}

#adminmenu a:hover,
#adminmenu li.menu-top > a:focus,
#adminmenu li.menu-top > a:focus-visible,
#adminmenu .wp-submenu a:hover,
#adminmenu .wp-submenu a:focus {
#adminmenu .wp-submenu a:focus-visible {
color: #72aee6;
}

#adminmenu a:hover,
#adminmenu a:focus,
#adminmenu a:focus-visible,
.folded #adminmenu .wp-submenu-head:hover {
box-shadow: inset 4px 0 0 0 currentColor;
transition: box-shadow 0.1s linear;
Expand Down Expand Up @@ -159,15 +159,15 @@
/* ensure that wp-submenu's box shadow doesn't appear on top of the focused menu item's background. */
#adminmenu li.menu-top:hover,
#adminmenu li.opensub > a.menu-top,
#adminmenu li > a.menu-top:focus {
#adminmenu li > a.menu-top:focus-visible {
position: relative;
background-color: #1d2327;
color: #72aee6;
}

.folded #adminmenu li.menu-top:hover,
.folded #adminmenu li.opensub > a.menu-top,
.folded #adminmenu li > a.menu-top:focus {
.folded #adminmenu li > a.menu-top:focus-visible {
z-index: 10000;
}

Expand Down Expand Up @@ -656,7 +656,7 @@ li#wp-admin-bar-menu-toggle {

.auto-fold #adminmenu li.menu-top:hover,
.auto-fold #adminmenu li.opensub > a.menu-top,
.auto-fold #adminmenu li > a.menu-top:focus {
.auto-fold #adminmenu li > a.menu-top:focus-visible {
z-index: 10000;
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/css/colors/_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ input[type="radio"]:focus {
#adminmenu a:hover,
#adminmenu li.menu-top:hover,
#adminmenu li.opensub > a.menu-top,
#adminmenu li > a.menu-top:focus {
#adminmenu li > a.menu-top:focus-visible {
color: variables.$menu-highlight-text;
background-color: variables.$menu-highlight-background;
}
Expand Down
Loading