-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
ToolsPanel: Display optional items when values are updated externally #47727
Conversation
Size Change: -32 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
Flaky tests detected in 816afb5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4119298207
|
Confirmed that this works as expected. I see the controls populate with proper values when copying styles from one block to another. ✅ |
@aaronrobertshaw this tested well for me with a single block selection, but not multiselection, so taking a look to see if I can work out why that is - but might be worth merging as is if that is not an easy fix as a single block is probably the most likely use case. |
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.
LGTM:
✅ Unit tests pass
✅ Storybook examples work the same as on trunk
✅ Pasting styles optional tools panel items causes the tools panel to rerender with the new controls in place with the correct settings
✅ Additional optional controls not in the pasted group are reset but still render
As already noted it doesn't work for multi-selected blocks but we should go ahead and merge this as the main use case will be single blocks and we can handle multi-selects separately later.
9785486
to
816afb5
Compare
Cherry-picked this PR to the wp/6.2 branch. |
Fixes: #47368
Related:
What?
Potentially fixes design tools not showing in the inspector when pasting block styles.
Note: If an optional control has been toggled on, or customized previously, then block styles are pasted, that optional control will continue to be displayed. It will reflect the current value though. Reselect the block, and that control will be hidden, as per normal.
Does this behaviour actually help highlight to the user what's changed?
Why?
When pasting styles, their values should be reflected in the design tools without having to de-select and re-select the block.
How?
Allows optional ToolsPanelItems to override the ToolsPanel's inner menu item state when the optional item previously wasn't toggled on for display.
Testing Instructions
npm run test:unit packages/components/src/tools-panel/test
npm run storybook:dev
- Ensure no behavioural differences between trunk and this branch. Particularly with the conditional item examples.Screenshots or screencast
Screen.Recording.2023-02-03.at.5.36.02.pm.mp4