-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Improve the way we handle custom units and how we interact with themes config. #33470
Copy link
Copy link
Closed
Labels
CustomizationIssues related to Phase 2: Customization effortsIssues related to Phase 2: Customization efforts[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.Questions or issues with incorporating or styling blocks in a theme.[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality
Description
There are a couple of issues with the way we handle units right now. Themes provide the available themes by adding spacing.units to their theme.json or by defining add_theme_support( 'custom-units' )
I noticed a number of issues though:
- If the theme doesn't define anything, we end up with
falsevalue for the config but since we have fallbacks each time we douseSetting( 'spacing.units' )in core blocks, it means we'll still allow custom units. I guess that means custom units are opt-out these days, that's fine but we should clarify how themes can opt-out of custom units and if that's even something we allow. - The other point is that if a theme removes
%from the available units, it is still possible to use a pattern or a variation with that unit (for instance columns variations), Right now, the block works well but the UI in the inspector shows another unit as selected, maybe we should show the unit but disabled? - The third item I noted is that right now it's too complex for blocks to use the units config, a fallback is necessary and a call to an experimental useCustomUnits hook is needed, I think ideally we should simplify that and just pass
useSetting( 'spacing.units' )as a prop to the UI component. Some refactoring/simplification might be needed there.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
CustomizationIssues related to Phase 2: Customization effortsIssues related to Phase 2: Customization efforts[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.Questions or issues with incorporating or styling blocks in a theme.[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality
Type
Fields
Give feedbackNo fields configured for issues without a type.