ToolsPanel: Add tools panel item deregistration#34085
Conversation
|
Size Change: +23 B (0%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
LGTM! Smoke tested that it doesn't affect any existing behaviour with the ToolsPanel in use for group, button and columns blocks, and no errors in the console.
I was wondering for a moment if label is always unique enough, but I think it's fair to expect that each item will have a unique label, and we're already treating it as a unique identifier in the toggleItem logic, so this looks good to me 👍
Update: confirmed that it's already documented that tools panel item labels are required and need to be unique 👍
|
Thanks for the review @andrewserong 🙇 The dual-purpose nature of the label, being both a human-readable string and the key by which menu items are found, is documented in the component readme. Should there be a desire to change that, we'll address it in a separate PR and this can change with it. |
Related: #34063
Description
ToolsPanelItems to deregister themselves from theToolsPaneland its menu state.This overcomes a problem encountered when injecting controls into a ToolsPanel via a
SlotFill. In that scenario, switching your block selection from one block to another with the sameToolsPanele.g. dimensions, would retain theSlotFillprovided item in the menu.How has this been tested?
Manually and via #34063.
Types of changes
Bug fix.
Checklist:
*.native.jsfiles for terms that need renaming or removal).