Administration: Ensure collapse menu is usable with a keyboard

Currently, the "Collapse menu" item is not focusable and keyboard users can't collapse/expand the admin menu. This aims to fix it so that screen readers no longer announce it as a clickable but it remains unfocusable and thus unusable. So it's now a button.

Quoting joedolson at WordCamp Chicago 2014:
"If it's supposed to act like a button, it should be a button."

Also includes a grunt:precommit run that picked up some postcss changes to src/wp-includes/css/customize-preview.css

Fixes .
Props ajercia, ipm-frommen for an iterative patch, valendesigns for an iterative patch, GaryJ for feedback, joedolson for feedback, helen for feedback



Built from https://develop.svn.wordpress.org/trunk@39141


git-svn-id: http://core.svn.wordpress.org/trunk@39081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2016-11-04 17:18:57 +00:00
parent 1281a28382
commit 53c8c68365
42 changed files with 500 additions and 334 deletions

View File

@ -547,79 +547,82 @@ ul#adminmenu > li.current > a.current:after {
display: none; display: none;
} }
#collapse-menu { #collapse-button {
font-size: 13px; display: block;
width: 100%;
height: 34px;
margin: 0;
border: none;
padding: 0;
position: relative;
overflow: visible;
line-height: 34px; line-height: 34px;
margin-top: 10px; background: none;
color: #a0a5aa; color: #aaa;
color: rgba(240,245,250,0.6); cursor: pointer;
-webkit-transition: all .1s ease-in-out; outline: 0;
transition: all .1s ease-in-out;
} }
#collapse-menu:hover, #collapse-button:hover,
#collapse-menu:hover #collapse-button div:after { #collapse-button:focus {
color: #00b9eb; color: #00b9eb;
} }
.folded #collapse-menu span { #collapse-button .collapse-button-icon,
#collapse-button .collapse-button-label {
/* absolutely positioned to avoid 1px shift in IE when button is pressed */
display: block;
position: absolute;
top: 0;
right: 0;
line-height: 34px;
}
#collapse-button .collapse-button-icon {
width: 36px;
height: 34px;
}
#collapse-button .collapse-button-label {
padding: 0 36px 0 0;
}
.folded #collapse-button .collapse-button-label {
display: none; display: none;
} }
#collapse-button, #collapse-button .collapse-button-icon:after {
#collapse-button div {
width: 15px;
height: 15px;
}
#collapse-button {
float: right;
height: 15px;
margin: 10px 11px 10px 8px;
width: 15px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#wpwrap #collapse-button div {
padding: 0;
}
#collapse-button div:after {
content: "\f148"; content: "\f148";
display: block; display: block;
line-height: 15px; position: relative;
right: -3px; top: 7px;
top: -3px; text-align: center;
color: #a0a5aa;
color: rgba(240,245,250,0.6);
font: normal 20px/1 dashicons !important; font: normal 20px/1 dashicons !important;
speak: none; speak: none;
margin: 0 auto;
padding: 0 !important;
position: relative;
text-align: center;
width: 20px;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
/* rtl:ignore */ /* rtl:ignore */
.folded #collapse-button div:after, .folded #collapse-button .collapse-button-icon:after,
.rtl #collapse-button div:after { .rtl #collapse-button .collapse-button-icon:after {
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg); -ms-transform: rotate(180deg);
transform: rotate(180deg); transform: rotate(180deg);
} }
.rtl.folded #collapse-button div:after { .rtl.folded #collapse-button .collapse-button-icon:after {
-webkit-transform: none; -webkit-transform: none;
-ms-transform: none; -ms-transform: none;
transform: none; transform: none;
} }
#collapse-button .collapse-button-icon:after,
#collapse-button .collapse-button-label {
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
/** /**
* Toolbar menu toggle * Toolbar menu toggle
*/ */
@ -731,22 +734,18 @@ li#wp-admin-bar-menu-toggle {
z-index: 10000; z-index: 10000;
} }
.auto-fold #collapse-menu span { .auto-fold #collapse-menu .collapse-button-label {
display: none; display: none;
} }
.auto-fold #collapse-button div {
background: none;
}
/* rtl:ignore */ /* rtl:ignore */
.auto-fold #collapse-button div:after { .auto-fold #collapse-button .collapse-button-icon:after {
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg); -ms-transform: rotate(180deg);
transform: rotate(180deg); transform: rotate(180deg);
} }
.rtl.auto-fold #collapse-button div:after { .rtl.auto-fold #collapse-button .collapse-button-icon:after {
-webkit-transform: none; -webkit-transform: none;
-ms-transform: none; -ms-transform: none;
transform: none; transform: none;

File diff suppressed because one or more lines are too long

View File

@ -547,79 +547,82 @@ ul#adminmenu > li.current > a.current:after {
display: none; display: none;
} }
#collapse-menu { #collapse-button {
font-size: 13px; display: block;
width: 100%;
height: 34px;
margin: 0;
border: none;
padding: 0;
position: relative;
overflow: visible;
line-height: 34px; line-height: 34px;
margin-top: 10px; background: none;
color: #a0a5aa; color: #aaa;
color: rgba(240,245,250,0.6); cursor: pointer;
-webkit-transition: all .1s ease-in-out; outline: 0;
transition: all .1s ease-in-out;
} }
#collapse-menu:hover, #collapse-button:hover,
#collapse-menu:hover #collapse-button div:after { #collapse-button:focus {
color: #00b9eb; color: #00b9eb;
} }
.folded #collapse-menu span { #collapse-button .collapse-button-icon,
#collapse-button .collapse-button-label {
/* absolutely positioned to avoid 1px shift in IE when button is pressed */
display: block;
position: absolute;
top: 0;
left: 0;
line-height: 34px;
}
#collapse-button .collapse-button-icon {
width: 36px;
height: 34px;
}
#collapse-button .collapse-button-label {
padding: 0 0 0 36px;
}
.folded #collapse-button .collapse-button-label {
display: none; display: none;
} }
#collapse-button, #collapse-button .collapse-button-icon:after {
#collapse-button div {
width: 15px;
height: 15px;
}
#collapse-button {
float: left;
height: 15px;
margin: 10px 8px 10px 11px;
width: 15px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#wpwrap #collapse-button div {
padding: 0;
}
#collapse-button div:after {
content: "\f148"; content: "\f148";
display: block; display: block;
line-height: 15px; position: relative;
left: -3px; top: 7px;
top: -3px; text-align: center;
color: #a0a5aa;
color: rgba(240,245,250,0.6);
font: normal 20px/1 dashicons !important; font: normal 20px/1 dashicons !important;
speak: none; speak: none;
margin: 0 auto;
padding: 0 !important;
position: relative;
text-align: center;
width: 20px;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
/* rtl:ignore */ /* rtl:ignore */
.folded #collapse-button div:after, .folded #collapse-button .collapse-button-icon:after,
.rtl #collapse-button div:after { .rtl #collapse-button .collapse-button-icon:after {
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg); -ms-transform: rotate(180deg);
transform: rotate(180deg); transform: rotate(180deg);
} }
.rtl.folded #collapse-button div:after { .rtl.folded #collapse-button .collapse-button-icon:after {
-webkit-transform: none; -webkit-transform: none;
-ms-transform: none; -ms-transform: none;
transform: none; transform: none;
} }
#collapse-button .collapse-button-icon:after,
#collapse-button .collapse-button-label {
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
/** /**
* Toolbar menu toggle * Toolbar menu toggle
*/ */
@ -731,22 +734,18 @@ li#wp-admin-bar-menu-toggle {
z-index: 10000; z-index: 10000;
} }
.auto-fold #collapse-menu span { .auto-fold #collapse-menu .collapse-button-label {
display: none; display: none;
} }
.auto-fold #collapse-button div {
background: none;
}
/* rtl:ignore */ /* rtl:ignore */
.auto-fold #collapse-button div:after { .auto-fold #collapse-button .collapse-button-icon:after {
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg); -ms-transform: rotate(180deg);
transform: rotate(180deg); transform: rotate(180deg);
} }
.rtl.auto-fold #collapse-button div:after { .rtl.auto-fold #collapse-button .collapse-button-icon:after {
-webkit-transform: none; -webkit-transform: none;
-ms-transform: none; -ms-transform: none;
transform: none; transform: none;

File diff suppressed because one or more lines are too long

View File

@ -227,23 +227,15 @@ ul#adminmenu > li.current > a.current:after {
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: $menu-collapse-text; color: $menu-collapse-text;
} }
#collapse-menu:hover { #collapse-button:hover,
color: $menu-collapse-focus-text; #collapse-button:focus {
color: $menu-submenu-focus-text;
} }
#collapse-button div:after {
color: $menu-collapse-icon;
}
#collapse-menu:hover #collapse-button div:after {
color: $menu-collapse-focus-icon;
}
/* Admin Bar */ /* Admin Bar */
#wpadminbar { #wpadminbar {

View File

@ -259,19 +259,12 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #e5f8ff; color: #e5f8ff;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
}
#collapse-button div:after {
color: #e5f8ff;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff; color: #fff;
} }

File diff suppressed because one or more lines are too long

View File

@ -259,19 +259,12 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #e5f8ff; color: #e5f8ff;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
}
#collapse-button div:after {
color: #e5f8ff;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff; color: #fff;
} }

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f3f2f1; color: #f3f2f1;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #c7a589;
#collapse-button div:after {
color: #f3f2f1;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f3f2f1; color: #f3f2f1;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #c7a589;
#collapse-button div:after {
color: #f3f2f1;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #ece6f6; color: #ece6f6;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #a3b745;
#collapse-button div:after {
color: #ece6f6;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #ece6f6; color: #ece6f6;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #a3b745;
#collapse-button div:after {
color: #ece6f6;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #777; color: #777;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #333; #collapse-button:focus {
} color: #04a4cc;
#collapse-button div:after {
color: #999;
}
#collapse-menu:hover #collapse-button div:after {
color: #555;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #777; color: #777;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #333; #collapse-button:focus {
} color: #04a4cc;
#collapse-button div:after {
color: #999;
}
#collapse-menu:hover #collapse-button div:after {
color: #555;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f1f2f3; color: #f1f2f3;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #e14d43;
#collapse-button div:after {
color: #f1f2f3;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f1f2f3; color: #f1f2f3;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #e14d43;
#collapse-button div:after {
color: #f1f2f3;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f2fcff; color: #f2fcff;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #9ebaa0;
#collapse-button div:after {
color: #f2fcff;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f2fcff; color: #f2fcff;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #9ebaa0;
#collapse-button div:after {
color: #f2fcff;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f3f1f1; color: #f3f1f1;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #f7e3d3;
#collapse-button div:after {
color: #f3f1f1;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -259,20 +259,13 @@ ul#adminmenu > li.current > a.current:after {
} }
/* Admin Menu: collapse button */ /* Admin Menu: collapse button */
#collapse-menu { #collapse-button {
color: #f3f1f1; color: #f3f1f1;
} }
#collapse-menu:hover { #collapse-button:hover,
color: #fff; #collapse-button:focus {
} color: #f7e3d3;
#collapse-button div:after {
color: #f3f1f1;
}
#collapse-menu:hover #collapse-button div:after {
color: #fff;
} }
/* Admin Bar */ /* Admin Bar */

File diff suppressed because one or more lines are too long

View File

@ -196,6 +196,7 @@ $document.ready( function() {
pinnedMenuTop = false, pinnedMenuTop = false,
pinnedMenuBottom = false, pinnedMenuBottom = false,
menuTop = 0, menuTop = 0,
menuState,
menuIsPinned = false, menuIsPinned = false,
height = { height = {
window: $window.height(), window: $window.height(),
@ -211,59 +212,43 @@ $document.ready( function() {
$(e.target).parent().siblings('a').get(0).click(); $(e.target).parent().siblings('a').get(0).click();
}); });
$('#collapse-menu').on('click.collapse-menu', function() { $( '#collapse-button' ).on( 'click.collapse-menu', function() {
var respWidth, state; var viewportWidth = getViewportWidth() || 961;
// reset any compensation for submenus near the bottom of the screen // reset any compensation for submenus near the bottom of the screen
$('#adminmenu div.wp-submenu').css('margin-top', ''); $('#adminmenu div.wp-submenu').css('margin-top', '');
if ( window.innerWidth ) { if ( viewportWidth < 960 ) {
// window.innerWidth is affected by zooming on phones
respWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
} else {
// IE < 9 doesn't support @media CSS rules
respWidth = 961;
}
if ( respWidth && respWidth < 960 ) {
if ( $body.hasClass('auto-fold') ) { if ( $body.hasClass('auto-fold') ) {
$body.removeClass('auto-fold').removeClass('folded'); $body.removeClass('auto-fold').removeClass('folded');
setUserSetting('unfold', 1); setUserSetting('unfold', 1);
setUserSetting('mfold', 'o'); setUserSetting('mfold', 'o');
state = 'open'; menuState = 'open';
} else { } else {
$body.addClass('auto-fold'); $body.addClass('auto-fold');
setUserSetting('unfold', 0); setUserSetting('unfold', 0);
state = 'folded'; menuState = 'folded';
} }
} else { } else {
if ( $body.hasClass('folded') ) { if ( $body.hasClass('folded') ) {
$body.removeClass('folded'); $body.removeClass('folded');
setUserSetting('mfold', 'o'); setUserSetting('mfold', 'o');
state = 'open'; menuState = 'open';
} else { } else {
$body.addClass('folded'); $body.addClass('folded');
setUserSetting('mfold', 'f'); setUserSetting('mfold', 'f');
state = 'folded'; menuState = 'folded';
} }
} }
currentMenuItemHasPopup(); $document.trigger( 'wp-collapse-menu', { state: menuState } );
$document.trigger( 'wp-collapse-menu', { state: state } );
}); });
// Handle the `aria-haspopup` attribute on the current menu item when it has a sub-menu. // Handle the `aria-haspopup` attribute on the current menu item when it has a sub-menu.
function currentMenuItemHasPopup() { function currentMenuItemHasPopup() {
var respWidth, var $current = $( 'a.wp-has-current-submenu' );
$current = $( 'a.wp-has-current-submenu' );
if ( window.innerWidth ) { if ( 'folded' === menuState ) {
respWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
} else {
respWidth = 961;
}
if ( $body.hasClass( 'folded' ) || ( $body.hasClass( 'auto-fold' ) && respWidth && respWidth <= 960 && respWidth > 782 ) ) {
// When folded or auto-folded and not responsive view, the current menu item does have a fly-out sub-menu. // When folded or auto-folded and not responsive view, the current menu item does have a fly-out sub-menu.
$current.attr( 'aria-haspopup', 'true' ); $current.attr( 'aria-haspopup', 'true' );
} else { } else {
@ -272,7 +257,7 @@ $document.ready( function() {
} }
} }
$document.on( 'wp-window-resized wp-responsive-activate wp-responsive-deactivate', currentMenuItemHasPopup ); $document.on( 'wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate', currentMenuItemHasPopup );
/** /**
* Ensure an admin submenu is within the visual viewport. * Ensure an admin submenu is within the visual viewport.
@ -836,17 +821,14 @@ $document.ready( function() {
}, },
trigger: function() { trigger: function() {
var width; var viewportWidth = getViewportWidth();
if ( window.innerWidth ) { // Exclude IE < 9, it doesn't support @media CSS rules.
// window.innerWidth is affected by zooming on phones if ( ! viewportWidth ) {
width = Math.max( window.innerWidth, document.documentElement.clientWidth );
} else {
// Exclude IE < 9, it doesn't support @media CSS rules
return; return;
} }
if ( width <= 782 ) { if ( viewportWidth <= 782 ) {
if ( ! wpResponsiveActive ) { if ( ! wpResponsiveActive ) {
$document.trigger( 'wp-responsive-activate' ); $document.trigger( 'wp-responsive-activate' );
wpResponsiveActive = true; wpResponsiveActive = true;
@ -858,7 +840,7 @@ $document.ready( function() {
} }
} }
if ( width <= 480 ) { if ( viewportWidth <= 480 ) {
this.enableOverlay(); this.enableOverlay();
} else { } else {
this.disableOverlay(); this.disableOverlay();
@ -912,8 +894,82 @@ $document.ready( function() {
aria_button_if_js(); aria_button_if_js();
}); });
/**
* @summary Get the viewport width.
*
* @since 4.7
*
* @returns {number|boolean} The current viewport width or false if the
* browser doesn't support innerWidth (IE < 9).
*/
function getViewportWidth() {
var viewportWidth = false;
if ( window.innerWidth ) {
// On phones, window.innerWidth is affected by zooming.
viewportWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
}
return viewportWidth;
}
/**
* @summary Set the admin menu collapsed/expanded state.
*
* Sets the global variable `menuState` and triggers a custom event passing
* the current menu state.
*
* @since 4.7
*
* @returns {void}
*/
function setMenuState() {
var viewportWidth = getViewportWidth() || 961;
if ( viewportWidth <= 782 ) {
menuState = 'responsive';
} else if ( $body.hasClass( 'folded' ) || ( $body.hasClass( 'auto-fold' ) && viewportWidth <= 960 && viewportWidth > 782 ) ) {
menuState = 'folded';
} else {
menuState = 'open';
}
$document.trigger( 'wp-menu-state-set', { state: menuState } );
}
// Set the menu state when the window gets resized.
$document.on( 'wp-window-resized.set-menu-state', setMenuState );
/**
* @summary Set ARIA attributes on the collapse/expand menu button.
*
* When the admin menu is open or folded, updates the `aria-expanded` and
* `aria-label` attributes of the button to give feedback to assistive
* technologies. In the responsive view, the button is always hidden.
*
* @since 4.7
*
* @returns {void}
*/
$document.on( 'wp-menu-state-set wp-collapse-menu', function( event, eventData ) {
var $collapseButton = $( '#collapse-button' ),
ariaExpanded = 'true',
ariaLabelText = commonL10n.collapseMenu;
if ( 'folded' === eventData.state ) {
ariaExpanded = 'false';
ariaLabelText = commonL10n.expandMenu;
}
$collapseButton.attr({
'aria-expanded': ariaExpanded,
'aria-label': ariaLabelText
});
});
window.wpResponsive.init(); window.wpResponsive.init();
setPinMenu(); setPinMenu();
setMenuState();
currentMenuItemHasPopup(); currentMenuItemHasPopup();
makeNoticesDismissible(); makeNoticesDismissible();
aria_button_if_js(); aria_button_if_js();

File diff suppressed because one or more lines are too long

View File

@ -234,9 +234,11 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
echo "</li>"; echo "</li>";
} }
echo '<li id="collapse-menu" class="hide-if-no-js"><div id="collapse-button"><div></div></div>'; echo '<li id="collapse-menu" class="hide-if-no-js">' .
echo '<span>' . esc_html__( 'Collapse menu' ) . '</span>'; '<button type="button" id="collapse-button" aria-label="' . esc_attr__( 'Collapse Main menu' ) . '" aria-expanded="true">' .
echo '</li>'; '<span class="collapse-button-icon" aria-hidden="true"></span>' .
'<span class="collapse-button-label">' . __( 'Collapse menu' ) . '</span>' .
'</button></li>';
} }
?> ?>

View File

@ -23,6 +23,7 @@
border: 0; border: 0;
background: transparent; background: transparent;
color: transparent; color: transparent;
-webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
outline: none; outline: none;
z-index: 5; z-index: 5;
@ -48,17 +49,39 @@
z-index: 5; z-index: 5;
background-color: #0085ba; background-color: #0085ba;
background: #0085ba; background: #0085ba;
-webkit-border-radius: 50%;
border-radius: 50%; border-radius: 50%;
border: 2px solid #fff; border: 2px solid #fff;
-webkit-box-shadow: 0 2px 1px rgba(46,68,83,0.15);
box-shadow: 0 2px 1px rgba(46,68,83,0.15); box-shadow: 0 2px 1px rgba(46,68,83,0.15);
text-align: center; text-align: center;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex; display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-moz-box-orient: horizontal;
-moz-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row; flex-direction: row;
-webkit-box-pack: center;
-webkit-justify-content: center;
-moz-box-pack: center;
-ms-flex-pack: center;
justify-content: center; justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
padding: 0; padding: 0;
-webkit-animation-fill-mode: both;
animation-fill-mode: both; animation-fill-mode: both;
-webkit-animation-duration: .4s;
animation-duration: .4s; animation-duration: .4s;
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
@ -84,10 +107,12 @@
} }
body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button { body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button {
-webkit-animation-name: customize-partial-edit-shortcut-bounce-appear;
animation-name: customize-partial-edit-shortcut-bounce-appear; animation-name: customize-partial-edit-shortcut-bounce-appear;
pointer-events: auto; pointer-events: auto;
} }
body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button { body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button {
-webkit-animation-name: customize-partial-edit-shortcut-bounce-disappear;
animation-name: customize-partial-edit-shortcut-bounce-disappear; animation-name: customize-partial-edit-shortcut-bounce-disappear;
pointer-events: none; pointer-events: none;
} }
@ -101,56 +126,138 @@ body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut bu
right: 0; right: 0;
} }
@keyframes customize-partial-edit-shortcut-bounce-appear { @-webkit-keyframes customize-partial-edit-shortcut-bounce-appear {
from, 20%, 40%, 60%, 80%, to { from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
} }
0% { 0% {
opacity: 0; opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3); transform: scale3d(.3, .3, .3);
} }
20% { 20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1); transform: scale3d(1.1, 1.1, 1.1);
} }
40% { 40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9); transform: scale3d(.9, .9, .9);
} }
60% { 60% {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03); transform: scale3d(1.03, 1.03, 1.03);
} }
80% { 80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97); transform: scale3d(.97, .97, .97);
} }
to { to {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1);
} }
} }
@keyframes customize-partial-edit-shortcut-bounce-appear {
from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
to {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@-webkit-keyframes customize-partial-edit-shortcut-bounce-disappear {
from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
20% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
40% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
60% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
80% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
to {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
}
@keyframes customize-partial-edit-shortcut-bounce-disappear { @keyframes customize-partial-edit-shortcut-bounce-disappear {
from, 20%, 40%, 60%, 80%, to { from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
} }
0% { 0% {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1);
} }
20% { 20% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97); transform: scale3d(.97, .97, .97);
} }
40% { 40% {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03); transform: scale3d(1.03, 1.03, 1.03);
} }
60% { 60% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9); transform: scale3d(.9, .9, .9);
} }
80% { 80% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1); transform: scale3d(1.1, 1.1, 1.1);
} }
to { to {
opacity: 0; opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3); transform: scale3d(.3, .3, .3);
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,7 @@
border: 0; border: 0;
background: transparent; background: transparent;
color: transparent; color: transparent;
-webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
outline: none; outline: none;
z-index: 5; z-index: 5;
@ -48,17 +49,39 @@
z-index: 5; z-index: 5;
background-color: #0085ba; background-color: #0085ba;
background: #0085ba; background: #0085ba;
-webkit-border-radius: 50%;
border-radius: 50%; border-radius: 50%;
border: 2px solid #fff; border: 2px solid #fff;
-webkit-box-shadow: 0 2px 1px rgba(46,68,83,0.15);
box-shadow: 0 2px 1px rgba(46,68,83,0.15); box-shadow: 0 2px 1px rgba(46,68,83,0.15);
text-align: center; text-align: center;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex; display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-moz-box-orient: horizontal;
-moz-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row; flex-direction: row;
-webkit-box-pack: center;
-webkit-justify-content: center;
-moz-box-pack: center;
-ms-flex-pack: center;
justify-content: center; justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
padding: 0; padding: 0;
-webkit-animation-fill-mode: both;
animation-fill-mode: both; animation-fill-mode: both;
-webkit-animation-duration: .4s;
animation-duration: .4s; animation-duration: .4s;
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
@ -84,10 +107,12 @@
} }
body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button { body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button {
-webkit-animation-name: customize-partial-edit-shortcut-bounce-appear;
animation-name: customize-partial-edit-shortcut-bounce-appear; animation-name: customize-partial-edit-shortcut-bounce-appear;
pointer-events: auto; pointer-events: auto;
} }
body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button { body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button {
-webkit-animation-name: customize-partial-edit-shortcut-bounce-disappear;
animation-name: customize-partial-edit-shortcut-bounce-disappear; animation-name: customize-partial-edit-shortcut-bounce-disappear;
pointer-events: none; pointer-events: none;
} }
@ -101,56 +126,138 @@ body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut bu
left: 0; left: 0;
} }
@keyframes customize-partial-edit-shortcut-bounce-appear { @-webkit-keyframes customize-partial-edit-shortcut-bounce-appear {
from, 20%, 40%, 60%, 80%, to { from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
} }
0% { 0% {
opacity: 0; opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3); transform: scale3d(.3, .3, .3);
} }
20% { 20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1); transform: scale3d(1.1, 1.1, 1.1);
} }
40% { 40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9); transform: scale3d(.9, .9, .9);
} }
60% { 60% {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03); transform: scale3d(1.03, 1.03, 1.03);
} }
80% { 80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97); transform: scale3d(.97, .97, .97);
} }
to { to {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1);
} }
} }
@keyframes customize-partial-edit-shortcut-bounce-appear {
from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
20% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
40% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
60% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
80% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
to {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
}
@-webkit-keyframes customize-partial-edit-shortcut-bounce-disappear {
from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
20% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97);
}
40% {
opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03);
}
60% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9);
}
80% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1);
}
to {
opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3);
}
}
@keyframes customize-partial-edit-shortcut-bounce-disappear { @keyframes customize-partial-edit-shortcut-bounce-disappear {
from, 20%, 40%, 60%, 80%, to { from, 20%, 40%, 60%, 80%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
} }
0% { 0% {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1);
} }
20% { 20% {
-webkit-transform: scale3d(.97, .97, .97);
transform: scale3d(.97, .97, .97); transform: scale3d(.97, .97, .97);
} }
40% { 40% {
opacity: 1; opacity: 1;
-webkit-transform: scale3d(1.03, 1.03, 1.03);
transform: scale3d(1.03, 1.03, 1.03); transform: scale3d(1.03, 1.03, 1.03);
} }
60% { 60% {
-webkit-transform: scale3d(.9, .9, .9);
transform: scale3d(.9, .9, .9); transform: scale3d(.9, .9, .9);
} }
80% { 80% {
-webkit-transform: scale3d(1.1, 1.1, 1.1);
transform: scale3d(1.1, 1.1, 1.1); transform: scale3d(1.1, 1.1, 1.1);
} }
to { to {
opacity: 0; opacity: 0;
-webkit-transform: scale3d(.3, .3, .3);
transform: scale3d(.3, .3, .3); transform: scale3d(.3, .3, .3);
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -79,6 +79,8 @@ function wp_default_scripts( &$scripts ) {
did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array( did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
'warnDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ), 'warnDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ),
'dismiss' => __( 'Dismiss this notice.' ), 'dismiss' => __( 'Dismiss this notice.' ),
'collapseMenu' => __( 'Collapse Main menu' ),
'expandMenu' => __( 'Expand Main menu' ),
) ); ) );
$scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 ); $scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta1-39140'; $wp_version = '4.7-beta1-39141';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.