-
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
Heading level style variations independent of markup #14183
Comments
Thanks for exploring this concept, @getdave! I like how you're thinking about accessibility impact, but trying to make visual design more flexible for users. I assume that the block variations that change the size of the heading visually would tie to theme styles or default styles set by Gutenberg? I wonder if it would be a better experience there to have size equivalents vs. the language around heading levels again? That may be confusing for some people. Maybe wording like: Largest, Large, Medium, Small, Smallest or something like that. |
Ideally I would like to do this. Not sure how that could work technically. Can Themes register editor css and can we detect whether is has been registered and if not then fall back to default Gutenberg styles?
I completely agree. Let's do that! |
@davidakennedy: Though not always the font size follows the heading level. |
@strarsis Thanks for your input here. Much appreciated. A couple of questions:
I'm not quite following you here. The variations I"m proposing here would need to map exactly to the heading levels. Can you clarify?
I'm proposing using the heading levels provided by the Theme (we'll need to document how Themes can write the styles to make them available in the editor) or using those provided by default in the editor. Would love to understand more about your concerns here. Any examples or use cases would definitely help. Much appreciated. |
Please see the |
Thanks for the idea, @getdave!
I definitely understand that use case behind this, but my gut reaction is that the approach isn't quite right. I think the main issue is the use of block styles: The styles in question are just font size changes, which is something that's usually handled by a dedicated sidebar control. In addition, these block styles introduce six whole new levels of hierarchy for users to think about, which seems like a little too much to handle. Also, I could see this method requiring a bunch of extra style rules for themes to implement. If we do decide to add font size controls to headings, I'd prefer it be done in the context of #8171, so that we have a cohesive set of font size controls across all text-based blocks. (I originally argued against including font size controls for headers in that ticket, but I understand the use case and the urge to include it). |
Closing in favour of #8171 |
Currently when adding a Heading Block to a page you can select the appropriate heading level (
h1 - h6
). Visual styles are applied based on this heading level. However, when building more complex pages it is sometimes a requirement to have a heading whose markup is set to levelX
but which is styled to look like heading levelY
.For example, my page might begin with a hero section followed by a "main content" block containing a another heading and a paragraph. For visual design reasons I might not want the heading within the hero to be too large. However the heading following the hero (in the main content area) might (for visual reasons) look better a little larger. Currently the only way to achieve this is to use an incorrect heading hierarchy (eg:
h2
for the hero heading andh1
for the main content heading) which is bad for a11y and SEO.In short, by tieing the visual styles of the headings directly to the selected heading level we restrict the flexibility of the Block for more advanced use cases.
Proposed Solution
I propose adding six heading level style variations to the
core/heading
Block - one for each heading level.Here is a screen capture of a prototype showing how this could work:
Note how you have 6 heading level styles to choose from. Each marries to its heading level counterpart. In the demo you will see the heading level is a
h2
but using the style variation I change it to look like ah5
.This is certainly an "advanced" use case, but I suggest as we introduce more page layout blocks it will become increasinly important as a feature to more advanced users.
Questions/Feedback Required
At this stage, I’m looking for feedback on:
The text was updated successfully, but these errors were encountered: