TextTransformControl/TextDecorationControl: Migrate to ToggleGroupControl#43328
TextTransformControl/TextDecorationControl: Migrate to ToggleGroupControl#43328
Conversation
|
Size Change: -128 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
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-decorationvalues 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 aradioat least for now.Testing Instructions
npm run storybook:devand see the stories for TextTransformControl/TextDecorationControl.npm run devand 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