-
Notifications
You must be signed in to change notification settings - Fork 4.6k
List View: Allow replacing template part when a block isn't selected #53757
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
Conversation
Size Change: +20 B (0%) Total Size: 1.51 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 testing nicely for me 👍
✅ Replacement while a template part block is selected works as usual
✅ Replacement is now possible while a block is not selected
✅ The option to replace is not available if multiple blocks are selected
This also happens on the trunk; we should investigate this separately.
Agreed, looking into this separately sounds good. It looks like it takes a moment for the new option to render, so it mightn't be as simple as shifting focus to it immediately 🤔
Another option could be that when the block is replaced, to shift focus to the list view row instead and close the options menu — a bit like how it's done when a block is duplicated via the options menu? In any case, not a blocker for this one.
LGTM! ✨
Thanks, @andrewserong! |
What?
Fixes #50928.
PR allows replacing a template part from List View block options when the block itself isn't selected.
Why?
This makes the feature consistent with block options in the toolbar.
How?
I've replaced the block level
isSelected
safeguard with a similar check inside theBlockSettingsMenuControls
render callback.Props to @getdave for inspiration.
P.S. I noticed that the focus isn't returned to the "Options" dropdown after replacement. Probably due to that, the new component in the list view is replaced, unmounting the old one and mounting the new one.
This also happens on the
trunk
; we should investigate this separately.Testing Instructions
footer
orheader
area template parts.Screenshots or screencast