Fix insertion point displaying when there are no inserter items#32576
Fix insertion point displaying when there are no inserter items#32576noisysocks merged 1 commit intotrunkfrom
Conversation
|
Size Change: +13 B (0%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
|
Looks like I'll need to revisit this once #31896 is merged, as that removes the isHidden variable this uses. |
Could we check the setting directly, instead of inserter items? This component is also being used for drag and drop and could in the future be used for more things like the "Move to" feature. |
b4022c0 to
91d2a73
Compare
|
@ellatrix I've reworked this and added a template lock check to the selector. |
| return false; | ||
| } | ||
|
|
||
| return true; |
There was a problem hiding this comment.
I never know what's the best layer to adjust here. Should we (also or instead) prevent insertion points to be set if the template is locked? And if so, in the component or reducer? I know that in a lot of other places we're doing a lot to prevent actions from even dispatching to the store if we know it won't change anything.
The question is a bit more general, but I think it would be good to see more consistency across the code base.
There was a problem hiding this comment.
For example, for the block drop zone, we are completely disabling it when the template is locked:
There was a problem hiding this comment.
So maybe we should disable the in-between inserter if the template is locked?
draganescu
left a comment
There was a problem hiding this comment.
In my testing this fixes all previous issues I noticed in the Widgets editor.
Description
Fixes #28123
In locked template areas (and other between blocks places where blocks can't be inserted), the insertion point indicator was still being displayed, though just the blue line without an inserter button.
To solve this, the
isInsertionPointVisibleselector now checks whether the insertion point's root client id has a template lock.To solve this, theInsertionPointPopovercomponent needs to do its own check forhasInserterItemsto get around this issue. This matches what the inserter button does:gutenberg/packages/block-editor/src/components/inserter/index.js
Line 225 in 3c722bf
gutenberg/packages/block-editor/src/components/inserter/index.js
Lines 296 to 299 in 3c722bf
How has this been tested?
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.jsfiles for terms that need renaming or removal).