-
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 Tools: Tracking defaults for blocks #35604
Comments
Yes, all text blocks should be supporting all tools (unless one doesn't make sense for some reason in a specific context, but I can't think of one right now) and we should use the defaults to emphasize the appropriate initial states for each. The lack of that control has been the main blocker to expand the tools to all blocks because it just made things a bit overwhelming. Now that we have the control we can support the tools while remaining lean. |
Just to confirm the full suite of typography tools for text block block.json files: "supports": {
...
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontFamily": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalLetterSpacing": true,
"__experimentalTextTransform": true,
"__experimentalTextDecoration": true
...
}
|
I believe text-decoration has been a bit challenging before? Also font-family is one I'm not sure we should be exposing in local contexts, only in global styles. If we can divide it in two passes, an initial set would be:
With this other list probably needing a more specific revision:
|
In WordPress/twentytwentytwo#108, we've been discussing strategies for styling hover/focus states for text links (which is more #27075 territory). Part of that discussion involves implementing more specific Do we think specific rules like those will end up as part of these tools, or should we stick to CSS? |
To expand on this: text-decoration is inherited all the way down the stack, and cannot be unset on an ancestor. So for example if an underlined text decoration is applied to the navigation block, every child element including everything from search fields and other items, get underlines that cannot be unset. So text-decoration should only ever be enabled for individual non-container blocks at the end of the hierarchy. |
Can anyone expand on this point? The question came up as to whether we should be removing font-family from blocks that have already opted in, e.g., Buttons in #30394 If we remove to remove font-family opt ins I think we'll need to update the deprecations for the following blocks (based on E2E failures we saw when we first removed it):
Happy to go ahead to do this if folks think we shouldn't be opting in. Thanks! |
Keeping in mind that it's very easy to flip the switch from hidden to surfaced, and that users can always click the ellipsis to add the control on a per-block basis, I do like the idea of starting simple and with as little as possible, then we can always revisit and toggle controls if we find it to be necessary. In the case of the heading block, it reminds me of a separate issue that we really should find a solution to. Right now it appears that you can only really set a global style for the Heading block itself, not individual configurations on a per level basis. In the use case above I would imagine they have assigned different fonts to different heading levels perhaps? |
Good point, Joen! Yes, being able to set font family (or other styles) by heading level would likely resolve that use case in many instances of it, I’d imagine. (The cases I’ve found on a couple of different sites used h3/h4 in the footer but h2 in the post content, so they’re a good fit). |
From a theme designer perspective, I guess it would be a comforting baseline to be able to dictate heading and other element styles in Still, opting in to font support is also something that theme developers can enable and disable – even on a per block basis – in On the specific question of whether we should remove opt-in supports for blocks that already support it for 5.9, I'm tending towards "no, for now". We can handle the changes in deprecations but I fear there wouldn't be enough time for testing regressions. |
I agree. Given that themes can switch off support as you mentioned, it sounds like a good one to leave for the moment, at least. |
👍 I think #34064 is ready for another round of review in that case. |
The Elements API via theme.json allows for some styling of the various heading elements
A theme designer should be able to do something like this. They can style elements via the theme.json and then use the theme.json settings to disable the UI for styles/features they don't want the user to override. |
Oh right, the elements, nice. But it would be nice to also pair that with a UI. I could imagine a collapsed singular Heading interface, but with option to "unfold" it to individual levels. Not something for the near future, but a thought. |
Part of #34345
We want there to be consistency of typography tools across core blocks. This means making sure core blocks are opted into the correct typography tools, and have appropriate defaults set.
Active work related to this:
The text was updated successfully, but these errors were encountered: