Customizer: Improve descriptive text and focus for menu items reorder button.

props afercia.
fixes #32725.

git-svn-id: https://develop.svn.wordpress.org/trunk@33074 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2015-07-03 21:23:12 +00:00
parent e33229a237
commit 787016376a
4 changed files with 26 additions and 4 deletions

View File

@@ -91,7 +91,14 @@
}
/* Menu-item reordering nav. */
#customize-theme-controls button.reorder-toggle {
#customize-theme-controls .reordering .reorder,
#customize-theme-controls .reorder-done {
display: none;
}
#customize-theme-controls .reorder,
#customize-theme-controls .reordering .reorder-done {
display: inline-block;
padding: 5px 8px;
}

View File

@@ -1932,6 +1932,9 @@
* @param {Boolean} showOrHide to enable/disable reordering
*/
toggleReordering: function( showOrHide ) {
var addNewItemBtn = this.container.find( '.add-new-menu-item' ),
reorderBtn = this.container.find( '.reorder-toggle' );
showOrHide = Boolean( showOrHide );
if ( showOrHide === this.$sectionContent.hasClass( 'reordering' ) ) {
@@ -1941,6 +1944,15 @@
this.isReordering = showOrHide;
this.$sectionContent.toggleClass( 'reordering', showOrHide );
this.$sectionContent.sortable( this.isReordering ? 'disable' : 'enable' );
if ( this.isReordering ) {
addNewItemBtn.attr( 'tabindex', '-1' );
reorderBtn.find( '.reorder-done' ).focus();
wp.a11y.speak( api.Menus.data.l10n.reorderModeOn );
} else {
addNewItemBtn.removeAttr( 'tabindex' );
reorderBtn.find( '.reorder' ).focus();
wp.a11y.speak( api.Menus.data.l10n.reorderModeOff );
}
if ( showOrHide ) {
_( this.getMenuItemControls() ).each( function( formControl ) {