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

props afercia.
fixes #32725.
Built from https://develop.svn.wordpress.org/trunk@33074


git-svn-id: http://core.svn.wordpress.org/trunk@33045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-07-03 21:24:25 +00:00
parent 86499fc07d
commit 200463d781
9 changed files with 39 additions and 10 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;
}

File diff suppressed because one or more lines are too long

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;
}

File diff suppressed because one or more lines are too long

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 ) {

File diff suppressed because one or more lines are too long

View File

@ -1450,10 +1450,11 @@ class WP_Customize_Nav_Menu_Control extends WP_Customize_Control {
<button type="button" class="button-secondary add-new-menu-item" aria-label="<?php esc_attr_e( 'Add or remove menu items' ); ?>" aria-expanded="false" aria-controls="available-menu-items">
<?php _e( 'Add Items' ); ?>
</button>
<button type="button" class="not-a-button reorder-toggle">
<span class="reorder"><?php _ex( 'Reorder', 'Reorder menu items in Customizer' ); ?></span>
<span class="reorder-done"><?php _ex( 'Done', 'Cancel reordering menu items in Customizer' ); ?></span>
<button type="button" role="presentation" class="not-a-button reorder-toggle" tabindex="-1">
<span class="reorder" tabindex="0" role="button" aria-label="<?php esc_attr_e( 'Reorder menu items' ); ?>" aria-describedby="reorder-items-desc"><?php _ex( 'Reorder', 'Reorder menu items in Customizer' ); ?></span>
<span class="reorder-done" tabindex="0" role="button" aria-label="<?php esc_attr_e( 'Close reorder mode' ); ?>"><?php _ex( 'Done', 'Cancel reordering menu items in Customizer' ); ?></span>
</button>
<p class="screen-reader-text" id="reorder-items-desc"><?php _e( 'When in reorder mode, additional controls to reorder menu items will be available in the items list above.' ); ?></p>
<span class="add-menu-item-loading spinner"></span>
<span class="menu-delete-item">
<button type="button" class="not-a-button menu-delete">

View File

@ -305,6 +305,8 @@ final class WP_Customize_Nav_Menus {
'itemsFound' => __( 'Number of items found: %d' ),
'itemsFoundMore' => __( 'Additional items found: %d' ),
'itemsLoadingMore' => __( 'Loading more results... please wait.' ),
'reorderModeOn' => __( 'Reorder mode enabled' ),
'reorderModeOff' => __( 'Reorder mode closed' ),
),
'menuItemTransport' => 'postMessage',
'phpIntMax' => PHP_INT_MAX,

View File

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