Customize: Accessibility: Label menu subitems when updating menus.

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
This commit is contained in:
joedolson 2024-03-01 16:21:10 +00:00
parent 1692cf3469
commit bee2debbd7
4 changed files with 22 additions and 4 deletions

View File

@ -1664,6 +1664,8 @@
$reorderNav = control.container.find( '.menu-item-reorder-nav' ); $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() { $reorderNav.find( '.menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right' ).on( 'click', function() {
var moveBtn = $( this ); var moveBtn = $( this );
control.params.depth = control.getDepth();
moveBtn.focus(); moveBtn.focus();
var isMoveUp = moveBtn.is( '.menus-move-up' ), var isMoveUp = moveBtn.is( '.menus-move-up' ),
@ -1677,8 +1679,19 @@
control.moveDown(); control.moveDown();
} else if ( isMoveLeft ) { } else if ( isMoveLeft ) {
control.moveLeft(); control.moveLeft();
if ( 1 === control.params.depth ) {
control.container.find( '.is-submenu' ).hide();
} else {
control.container.find( '.is-submenu' ).show();
}
} else if ( isMoveRight ) { } else if ( isMoveRight ) {
control.moveRight(); 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. moveBtn.focus(); // Re-focus after the container was moved.

File diff suppressed because one or more lines are too long

View File

@ -69,18 +69,23 @@ class WP_Customize_Nav_Menu_Item_Control extends WP_Customize_Control {
<span class="item-title" aria-hidden="true"> <span class="item-title" aria-hidden="true">
<span class="spinner"></span> <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> <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>
<span class="item-controls"> <span class="item-controls">
<button type="button" class="button-link item-edit" aria-expanded="false"><span class="screen-reader-text"> <button type="button" class="button-link item-edit" aria-expanded="false"><span class="screen-reader-text">
<?php <?php
/* translators: 1: Title of a menu item, 2: Type of a menu item. */ /* 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> </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"> <button type="button" class="button-link item-delete submitdelete deletion"><span class="screen-reader-text">
<?php <?php
/* translators: 1: Title of a menu item, 2: Type of a menu item. */ /* 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></button>
</span> </span>

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.