-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Typography panel: Component upsizing #36230
Comments
I took a brief look at switching these typography controls to use In the context of block supports, the ability to toggle it off was required to allow for any styles applied by the theme or global styles to take effect. If it interests, here is a quick patch to see this in actiondiff --git a/packages/block-editor/src/components/text-transform-control/index.js b/packages/block-editor/src/components/text-transform-control/index.js
index 262484d843..ede7f11571 100644
--- a/packages/block-editor/src/components/text-transform-control/index.js
+++ b/packages/block-editor/src/components/text-transform-control/index.js
@@ -1,29 +1,27 @@
/**
* WordPress dependencies
*/
-import { Button } from '@wordpress/components';
-import { __ } from '@wordpress/i18n';
import {
- formatCapitalize,
- formatLowercase,
- formatUppercase,
-} from '@wordpress/icons';
+ __experimentalToggleGroupControl as ToggleGroupControl,
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
+} from '@wordpress/components';
+import { __ } from '@wordpress/i18n';
const TEXT_TRANSFORMS = [
{
name: __( 'Uppercase' ),
+ label: 'AB',
value: 'uppercase',
- icon: formatUppercase,
},
{
name: __( 'Lowercase' ),
+ label: 'ab',
value: 'lowercase',
- icon: formatLowercase,
},
{
name: __( 'Capitalize' ),
+ label: 'Ab',
value: 'capitalize',
- icon: formatCapitalize,
},
];
@@ -38,28 +36,22 @@ const TEXT_TRANSFORMS = [
*/
export default function TextTransformControl( { value, onChange } ) {
return (
- <fieldset className="block-editor-text-transform-control">
- <legend>{ __( 'Letter case' ) }</legend>
- <div className="block-editor-text-transform-control__buttons">
- { TEXT_TRANSFORMS.map( ( textTransform ) => {
- return (
- <Button
- key={ textTransform.value }
- icon={ textTransform.icon }
- isSmall
- isPressed={ value === textTransform.value }
- aria-label={ textTransform.name }
- onClick={ () =>
- onChange(
- value === textTransform.value
- ? undefined
- : textTransform.value
- )
- }
- />
- );
- } ) }
- </div>
- </fieldset>
+ <ToggleGroupControl
+ value={ value }
+ onChange={ onChange }
+ label={ __( 'Letter case' ) }
+ isBlock
+ >
+ { TEXT_TRANSFORMS.map( ( textTransform ) => {
+ return (
+ <ToggleGroupControlOption
+ key={ textTransform.value }
+ label={ textTransform.label }
+ aria-label={ textTransform.name }
+ value={ textTransform.value }
+ />
+ );
+ } ) }
+ </ToggleGroupControl>
);
}
|
Mmm, good point. I'm going to break this one out into a discrete issue (#36735). If there aren't any clear solutions, it might be better to keep the existing implementation for now. |
Thank you for looking into this, @mirka ! The changes that you're proposing definitely go in a good direction — standardizing our UI! I have a few considerations:
|
I think a manageable scope to start with is to care about consistency within "form" elements only (e.g. buttons, inputs, selects, etc). As for the actual size scale naming, my assessment of the current landscape and designer sentiment is that we're not at all ready to commit to anything 😅 (I attempted to establish a size scale beforehand but it turned out to be unfeasible.) I'm so hesitant to commit to size names at this stage, even the
You're right, I guess that will be true in most cases, and like you said before it's pretty much unavoidable to use experimental components inside mature ones. |
Makes sense
That's my fear too. Let's see how things evolve here, and let's consider other potential conventions too in case we can think about any alternative.
Agreed! Of course that doesn't mean that we shouldn't be mindful when using experimental components |
On hold until #39397 is addressed.
Tasks required to cleanly migrate the Typography panel components to the new 40px sizes.
Prep work (merge at will)
__unstable-large
size variant onInputControl
SelectControl
UnitControl
#35646ToggleGroupControlOption
🧪 (See TextTransformControl/TextDecorationControl: Balancing usability and accessibility #36735)NumberControl
#37110Final steps to enable changes (merge all at once)
(We can merge these into a temporary branch for testing before the final merge)
__unstableSize
prop in Typography panel #36162__unstableSize
prop in Typography panel #36196FontFamilyControl
🧪 andLetterSpacingControl
🧪TextTransformControl
🧪 andTextDecorationControl
🧪 implementation withToggleGroupControl
🧪The text was updated successfully, but these errors were encountered: