-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Choose menu label when a menu has been deleted. #67009
base: trunk
Are you sure you want to change the base?
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +16 B (0%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
Attempting to fix the failing test. I have a question: |
Flaky tests detected in bfd0f10. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11840242754
|
@@ -106,12 +107,18 @@ function NavigationMenuSelector( { | |||
const noBlockMenus = ! hasNavigationMenus && hasResolvedNavigationMenus; | |||
const menuUnavailable = | |||
hasResolvedNavigationMenus && currentMenuId === null; | |||
const navMenuHasBeenDeleted = currentMenuId && isNavigationMenuMissing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In trunk we have some similar checks and others with hasResolvedNavigationMenus && isNavigationMenuMissing
. I'm wondering why that difference and mostly why isn't isNavigationMenuMissing
is doing this check internally in the hook.
@afercia 's comment about Specifically in this scenario, currentMenuId && isNavigationMenuMissing is true, while menuUnavailable is false.
and why we weren't passing the id here are good ones. Maybe @getdave or @draganescu have more context?
Fixes part of #59431
What?
See #59431 (comment)
When a menu has been deleted, the settings panel shows a warning Notice. In that state, the ellipsis button to choose a menu is unlabeled. The condition to set the dynamic label fails and doesn't take into account this scenario.
Why?
All controls should always be properly labeled.
How?
It appears the condition to render the Norice:
gutenberg/packages/block-library/src/navigation/edit/menu-inspector-controls.js
Line 96 in a120f10
is slightly different from the condition(s) used to determine the ellipsis button label:
gutenberg/packages/block-library/src/navigation/edit/navigation-menu-selector.js
Lines 105 to 117 in a120f10
Specifically in this scenario,
currentMenuId && isNavigationMenuMissing
is true, whilemenuUnavailable
is false.I'm not familiar with this part to determine whether
menuUnavailable
is incorrect in the first place and whether it should be reviewed. For now, I'm just adding one more check, which is the same one used for the Notice, to render the label 'Choose or create a Navigation Menu'. Any feedback on the currentmenuUnavailable
would be appreciated.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast