-
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
TextTransformControl/TextDecorationControl: Migrate to ToggleGroupControl #43328
Conversation
Size Change: -128 B (0%) Total Size: 1.24 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.
Makes complete sense to use a radio and rely on ToolsPanel
to unselect. Love that it lets us remove some code too. I checked the storybooks and tested a few blocks that use these controls. Looks great! 👍
Kapture.2022-08-18.at.11.39.35.mp4
packages/block-editor/src/components/text-decoration-control/index.js
Outdated
Show resolved
Hide resolved
I just realised while working on #43356 that relying on the tools panel mechanism to unset the Letter case value won't work when we add Letter case to Global Styles (see #34345 (comment)) where we don't use a tools panel 😕 |
Thanks for the review! Given that we do have a reset mechanism in GS (discoverability/usability questionable 😅), would you say this is a blocker for merging this one? I think replacing these controls with a |
03edcb4
to
7a496a4
Compare
The existing mechanism resets every setting, no? I think that's too nuclear and could lead to frustration.
Happy to address it in a separate PR but think we need to have an idea of what direction we want to head in before we merge this PR. Reading through #36735, there seems to be some confusion about keeping click to unset—I don't think we're 100% aligned 😅 |
Part of #34345 #41973
Closes #36735
What?
Replaces the internal implementation of TextTransformControl and TextDecorationControl to a ToggleGroupControl.
Why?
The previous implementation allowed a "click to unselect" interaction, but failed to semantically capture that the options were mutually exclusive (#36735). We've decided to let go of the "click to unselect" interaction (in favor of the higher-level reset actions), so we can use a standard ToggleGroupControl. So this now becomes a proper
radio
.By using a ToggleGroupControl, we'll also get the large size variants which will be required to upsize the Typography controls in the editor.
Aside on TextDecorationControl
Technically,
text-decoration
values do not need to be mutually exclusive. But since the previous implementation behaves as mutually exclusive, and because it's highly unlikely that anyone would want anunderline line-through
, we'll be sticking to aradio
at least for now.Testing Instructions
npm run storybook:dev
and see the stories for TextTransformControl/TextDecorationControl.npm run dev
and add a Code block to the editor. Add the "Decoration" and "Letter case" controls to the Typography section in the Inspector. The controls should work as expected.Screenshots or screencast