-
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 navigation block off-canvas appender for empty menus #48907
Fix navigation block off-canvas appender for empty menus #48907
Conversation
- Pass the parent client id in as a prop instead of trying to determine the id from inner blocks
Thanks, Dan! I also noticed this just now while working on a separate issue. |
Size Change: +2 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
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 fix works as expected ✅
I think it's better to fix this bug now for WordPress 6.2 and think about a more general solution to the differences between OffCanvasEditor and ListView later.
Sounds good to me 👍
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 fixing this @talldan 👍
I could replicate the issue on trunk and this PR fixes it for me. While I'm not hugely familiar with the workings of the Off Canvas Editor, the code changes make sense to me.
Before | After |
---|---|
Thanks @talldan 👍 |
- Pass the parent client id in as a prop instead of trying to determine the id from inner blocks
I just cherry-picked this PR to the wp/6.2 branch to get it included in the next release: 9410fd7. |
What?
Fixes an issue with the navigation block's off canvas appender, where when trying to add a block to an empty menu, the pattern view of the quick inserter was being shown instead of the list of block types.
How?
The issue is that the parent client id (the client id of the navigation block) was being determined by checking the parent of the first child block.
When there are no inner blocks, this fails and the quick inserter thinks a block is being inserted at the root level, so shows patterns instead of block types.
The fix is to pass the parent client id as a prop of the
OffCanvasEditor
. Previously I think this was avoided because it would make it hard to merge this code back into the mainListView
component, but that code was written when empty menus had no appender.I think it's better to fix this bug now for WordPress 6.2 and think about a more general solution to the differences between
OffCanvasEditor
andListView
later.The
OffCanvasEditor
is private, so there's no detriment to external APIs.Testing Instructions
Expected: It should show a list of block types
In trunk: It shows patterns
Screenshots or screencast
Before
After