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 template part actions in List View #48905
Conversation
- Use the selectedClientIds param from the `BlockSettingsMenuControls` fill instead of selected blocks from the store
Size Change: -10 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.
Great catch, and nice explanation of the issue!
It looks the same issue might also be happening with the Replace <BlockTitle />
(Replace Header) and Group menu items. In the below screenshot, the top-most group block's ellipsis menu is opened, but shows Replace Header because the Header block is selected:
Would it be good to try to fix them up at the same time, or in a separate PR, do you think?
Oh yeah, that's a shame. I'll do separate PRs! 😄 |
I've made a PR to fix the grouping actions - #48910. The Replace template part actions are a little more complicated to untangle. |
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 @talldan, good idea breaking it up into smaller PRs. This one looks good to go to me! ✨
What?
Fixes #48818
As described on the issue, the 'Create template part' or 'Convert to regular blocks' actions in the block settings menu don't always work as expected in List View.
For List View, a user can perform one of those actions on a non-selected block. The code was written with the assumption that the action would always be carried out on a selected block as would always be the case in the editor canvas.
I imagine that code predates the existence of the menu in List View.
How?
Updates the code to use the
selectedClientIds
param from theBlockSettingsMenuControls
fill, which provides the correct block client Ids to perform the operation on.This required a little bit of a refactor. The
BlockSettingsMenuControls
component now has to be higher in the component tree. This doesn't seem to cause any unwanted side-effects from my testing.Testing Instructions
Template parts > My Group
.In trunk: 🐞 Notice that the template part contains the Paragraph block, rather than the Group block.
In this PR: ✅ The template part correctly contains the group block
Screenshots or screencast
Before
Kapture.2023-03-08.at.11.43.27.mp4
After
Kapture.2023-03-08.at.11.39.50.mp4