Heading: Fix per-level element style overrides #49189
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #49070
What?
Corrects the CSS selector used for generating h1-h6 element style overrides for the Heading block.
Why?
Without the correct selectors a theme author can't override the Heading block styles per level.
How?
As the heading elements are a special edge case, this quick fix adds a conditional to the generation of element selectors during the theme.json block metadata processing. If the element in question is
h1-h6
it will prepend the element selector to the block selector instead of appending the element as a child to the block selector.Testing Instructions
h1-h6
element style, then update thecore/heading
block styles to include an override for a specifich1-h6
element style.Theme.json Snippet
Example block markup
Screenshots or screencast