-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 create menu after menu switch #59630
Conversation
Size Change: +1.08 kB (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
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. |
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.
Makes perfect sense and fixes the issue.
@scruffian @afercia @draganescu As this bug was uncovered during the RC phase do you feel that it should be included in the WP 6.5? If so why? Noting that if required, we will need to present a rationale to the release team to clear this to land. As a member of that team I would prefer not to cast my opinion without first receiving your feedback. Much appreciated. |
100% it should be included in PW 6.5 because it's a severe bug (unable to access the create functionality) of a block central to developing a website which is what WP does. It also is a bug that I think was there for at least one release. |
… able to clean state after ref is updated
6a3df80
to
c2c53d1
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c6b9ef3
to
1e45317
Compare
packages/block-library/src/navigation/edit/navigation-menu-selector.js
Outdated
Show resolved
Hide resolved
…sed on resolving menus
I have updated the I've updated the tests accordingly to take into account that the disabled state depends on The more I spend time here the more useless |
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.
Thanks for this PR and working on a fix to this bug.
I see the original bug is resolved with the Create menu
option enabled even when you switch menus.
However, if I click Create new menu
I would expect the options to switch my menu to be disabled during that process's resolution. Currently they are not for both block and classic menus you might have.
packages/block-library/src/navigation/edit/test/navigation-menu-selector.js
Show resolved
Hide resolved
… undo the focus update
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.
The UI doesn't seem blocked to me when creating a menu.
If I switch to slow network this becomes very obvious
Screen.Capture.on.2024-03-11.at.15-13-23.mp4
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.
Tested and it is now working correctly. I couldn't break it no matter what I triend with slow network or otherwise.
Thanks for your persistence with this problem 👍
hasResolvedNavigationMenus, | ||
createNavigationMenuIsSuccess, | ||
canUserCreateNavigationMenu, | ||
createNavigationMenuIsError, | ||
isCreatingMenu, | ||
isUpdatingMenuRef, | ||
menuUnavailable, | ||
noBlockMenus, | ||
noMenuSelected, |
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.
We should be able to remove all the unused deps from this effect.
I propose we do this in a followup.
* don't set creating menu flag on menu switch * return Promises from the navigation menu ref changing functions to be able to clean state after ref is updated * update tests * await the menu creation * stub test updates * revert test changes and remove decorative promises * do not disable the UI when changing the navigation, disable the UI based on resolving menus * block the UI for menu switching too, update tests with some comments, undo the focus update * properly disable menu choices via their choices prop Co-authored-by: draganescu <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: afercia <[email protected]> # Conflicts: # packages/block-library/src/navigation/edit/test/navigation-menu-selector.js
I just manually cherry-picked this PR to the pick/wp-65-rc-2 branch to get it included in the next release |
* don't set creating menu flag on menu switch * return Promises from the navigation menu ref changing functions to be able to clean state after ref is updated * update tests * await the menu creation * stub test updates * revert test changes and remove decorative promises * do not disable the UI when changing the navigation, disable the UI based on resolving menus * block the UI for menu switching too, update tests with some comments, undo the focus update * properly disable menu choices via their choices prop Co-authored-by: draganescu <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: afercia <[email protected]> # Conflicts: # packages/block-library/src/navigation/edit/test/navigation-menu-selector.js
While this PR fixes the disabled state of the 'Create new menu' button, it introduces a regression. There is now a focus loss when creating a new menu because the whole dropdown menu stays open but all menu items gets 'disabled', including the menu item that had keyboard focus. It is important to point out, once again, a very important principle: Important Never, ever, disable controls dynamically while they have focus. I'd appreciate that this kind of changes are tested with keyboard as clearly this wasn't the case in this PR. Thanks. I will create a separate issue, and this needs to be addressed soon as it's a regression in RC. |
Agreed. Are you able to tackle this one? The next RC is RC3 on 19th March. |
* don't set creating menu flag on menu switch * return Promises from the navigation menu ref changing functions to be able to clean state after ref is updated * update tests * await the menu creation * stub test updates * revert test changes and remove decorative promises * do not disable the UI when changing the navigation, disable the UI based on resolving menus * block the UI for menu switching too, update tests with some comments, undo the focus update * properly disable menu choices via their choices prop Co-authored-by: draganescu <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: jeryj <[email protected]> Co-authored-by: getdave <[email protected]> Co-authored-by: afercia <[email protected]>
What?
Closes #59604 - create menu is available as an option after menu switching.
Why?
Bug fix.
How?
Removes a seemingly useless? call to setting a state about creating a menu (
setIsCreatingMenu
) which makes no sense in the context of switching a menu.Testing Instructions
Testing Instructions for Keyboard
N/A
Screenshots or screencast
create-new-menu.mp4