-
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
Only show submenu options and Show arrow button when relevant. #36826
Conversation
a3cfb2c
to
1e5cfa6
Compare
This is excellent, thank you! I'll take a look when I have a moment. |
Size Change: +998 B (0%) Total Size: 1.1 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.
This is working super well, thank you for fast work!
I would encourage just a small sanity check, perhaps @georgeh? But overall looks great to me!
( select ) => { | ||
const { getBlocks, hasSelectedInnerBlock } = select( | ||
blockEditorStore | ||
); | ||
const blocks = getBlocks( clientId ); | ||
const didFindSubmenu = !! blocks.find( |
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.
Something about the variable "didFindSubmenu" feels curious to me. Could it just be called "submenus"?
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.
hasSubmenus
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.
I didn't use hasSubmenus
because that's how I named the variable in the outer scope; I'll go with foundSubmenu
, as it describes what the line is doing; using find
to figure out if there's at least one submenu present.
Looks good, ship it! |
Description
Addresses #36698.
block has at least one Submenu.
Screenshots
Open on click and Show arrow interaction
Edit.Post.Navigation.Menu.gutenberg.WordPress.Mozilla.Firefox.2021-11-24.11-58-12.mp4