You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Post Comments Form: ensure typography styles are applied to child elements #36188
[Block] Comments (legacy)The legacy mode of the Comments block (formerly known as Post Comments)[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Status] In ProgressTracking issues with work in progress
In #34064 we opted into and added default Typography support controls.
For the Post Comments Form, we noticed that the <h3 /> element isn't targeted by some of the Typography settings set at the container: the font weight gets applied at the container, but not the heading.
This works, but has the downside of adding to every block's container element – blocks that opt-in to typography controls – classes that we might not ever be able to remove if folks start relying on their existence.
We could, just for starters, add these classes in the post-comments-form/index.php
Copying inline styles seems also messy on the face of it, and only targets the h3 so if the markup changes in the future we might have to add further styles, or whatever.
[Block] Comments (legacy)The legacy mode of the Comments block (formerly known as Post Comments)[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Status] In ProgressTracking issues with work in progress
Activity
ramonjd commentedon Nov 4, 2021
It might be theme related. For example, TT1 defines the following in theme.json
These styles overwrite the inline styles applied to the container.
Removing this allows me to style the entire container and its child elements in this very contrived example:
To give the inline styles priority over the theme styles, even something like this is too specific:
The above will overwrite the theme styles when there are no inline typography styles.
But maybe that's okay since we're dealing with a specific use of
h3, that is, inside a post comments form?I'm sure there's a neat trick, but it's eluding me so far.
ramonjd commentedon Nov 11, 2021
Just jotting down some whacky ideas:
Add a class to the wrapper for each typography style in
gutenberg/lib/block-supports/typography.php
Line 68 in 1e17b5a
Then overwrite the theme default styles for this particular block like this:
Resulting in the following markup:
This works, but has the downside of adding to every block's container element – blocks that opt-in to typography controls – classes that we might not ever be able to remove if folks start relying on their existence.
We could, just for starters, add these classes in the post-comments-form/index.php
Copy the container's inline styles to the
h3So, something like:
Copying inline styles seems also messy on the face of it, and only targets the h3 so if the markup changes in the future we might have to add further styles, or whatever.