-
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 navigation editor missing appender not showing appender when no blocks selected #34678
Conversation
const appender = | ||
isSelected || | ||
( isImmediateParentOfSelectedBlock && ! selectedBlockHasDescendants ) | ||
? undefined |
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.
It turns out that InnerBlock.DefaultAppender
isn't a thing, it resolves as undefined
, so I've just put undefined
here 😆
Size Change: +1.88 kB (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
} ) => { | ||
return ( | ||
<BaseButtonBlockAppender | ||
className={ classnames( { | ||
'block-list-appender__toggle': isToggle, |
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.
There's some code smell with this classname, it was added to BlockListAppender
at some point in the past, but it should really be part of the ButtonBlockAppender
component. It's also missing the block-editor
prefix. I'll work on a separate PR to fix it.
.block-editor-block-list__block:not(.is-selected):not(.has-child-selected):not(.block-editor-block-list__layout) { | ||
.block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle { | ||
opacity: unset; | ||
transform: unset; | ||
} | ||
} |
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 block editor also has CSS to hide the appender, so that needs to be unset.
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 the review! The styling improvements just merged in #34281 should fix the issue with the appender position. |
Description
Fixes #31276
This fix is frustratingly complex.
The main problem is that the navigation block has its own custom logic for appender visibility, which conflicts with the desired behavior for the navigation editor.
The secondary problem is that even without the navigation block's custom logic, the block editor's default appender wouldn't be displayed anyway. When all blocks are deselected the block editor would usually show an appender at the root level, but not if that root level is a locked template, which is the case in the navigation editor.
This PR fixes things by supplying a completely custom appender implementation to the Navigation Block—yet another place where the block is being extend by the editor.
But at least with this situation, the navigation editor is in complete control of when the appender is shown, and this logic can be changed to whatever is desired now, even the appearance of the appender could be changed.
How has this been tested?
Expected: the appender should still be visible
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).