Skip to content

Commit

Permalink
Customize: Accessibility: Label menu subitems when updating menus.
Browse files Browse the repository at this point in the history
Fix missing subitem indicator when menu items in the Customizer are children of parent menu items & add menu item original title to button text. Adds parity with the admin menu editor and fixes a bug where the button text was 'untitled' if the menu item title had not been edited.

Props designsimply, afercia, celloexpressions, kushang78, joedolson, rcreators.
Fixes #32728.
Built from https://develop.svn.wordpress.org/trunk@57746


git-svn-id: http://core.svn.wordpress.org/trunk@57247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
joedolson committed Mar 1, 2024
1 parent 1692cf3 commit bee2deb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
13 changes: 13 additions & 0 deletions wp-admin/js/customize-nav-menus.js
Expand Up @@ -1664,6 +1664,8 @@
$reorderNav = control.container.find( '.menu-item-reorder-nav' );
$reorderNav.find( '.menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right' ).on( 'click', function() {
var moveBtn = $( this );
control.params.depth = control.getDepth();

moveBtn.focus();

var isMoveUp = moveBtn.is( '.menus-move-up' ),
Expand All @@ -1677,8 +1679,19 @@
control.moveDown();
} else if ( isMoveLeft ) {
control.moveLeft();
if ( 1 === control.params.depth ) {
control.container.find( '.is-submenu' ).hide();
} else {
control.container.find( '.is-submenu' ).show();
}
} else if ( isMoveRight ) {
control.moveRight();
control.params.depth += 1;
if ( 0 === control.params.depth ) {
control.container.find( '.is-submenu' ).hide();
} else {
control.container.find( '.is-submenu' ).show();
}
}

moveBtn.focus(); // Re-focus after the container was moved.
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/customize-nav-menus.min.js

Large diffs are not rendered by default.

Expand Up @@ -69,18 +69,23 @@ public function content_template() {
<span class="item-title" aria-hidden="true">
<span class="spinner"></span>
<span class="menu-item-title<# if ( ! data.title && ! data.original_title ) { #> no-title<# } #>">{{ data.title || data.original_title || wp.customize.Menus.data.l10n.untitled }}</span>
<# if ( 0 === data.depth ) { #>
<span class="is-submenu" style="display: none;"><?php _e( 'sub item' ); ?></span>
<# } else { #>
<span class="is-submenu"><?php _e( 'sub item' ); ?></span>
<# } #>
</span>
<span class="item-controls">
<button type="button" class="button-link item-edit" aria-expanded="false"><span class="screen-reader-text">
<?php
/* translators: 1: Title of a menu item, 2: Type of a menu item. */
printf( __( 'Edit menu item: %1$s (%2$s)' ), '{{ data.title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.item_type_label }}' );
printf( __( 'Edit menu item: %1$s (%2$s)' ), '{{ data.title || data.original_title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.item_type_label }}' );
?>
</span><span class="toggle-indicator" aria-hidden="true"></span></button>
<button type="button" class="button-link item-delete submitdelete deletion"><span class="screen-reader-text">
<?php
/* translators: 1: Title of a menu item, 2: Type of a menu item. */
printf( __( 'Remove Menu Item: %1$s (%2$s)' ), '{{ data.title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.item_type_label }}' );
printf( __( 'Remove Menu Item: %1$s (%2$s)' ), '{{ data.title || data.original_title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.item_type_label }}' );
?>
</span></button>
</span>
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-beta3-57745';
$wp_version = '6.5-beta3-57746';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit bee2deb

Please sign in to comment.