-
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
[Heading block] Per-level styling of heading blocks does not work #49070
Comments
As this was introduced in 6.2 and is not working, it can be fixed in 6.2 RC3 if ready in time. Please advise @adamziel @Mamaduka @nickcernis |
Related to #42122 (comment). |
I think this is a very involved fix. At the moment element selectors as output using this:
In this specific case (and only in this case) we need to output the selector using this:
The difficult part is determining when to use this selector. I think what we need is some config inside the
This seems very verbose, I'm sure there's a better way. Pinging @aaronrobertshaw because of this work on #46496. |
Thanks for the ping @scruffian 👍
Given the impact of the bug and the fact it sounds very specific to the heading block edge case. I think getting in a quick fix to buy us some time on a more elegant and flexible solution makes sense. I've knocked up a quick fix in #49189.
Such an approach might provide the most flexibility overall. As for the proposed shape, I think we'd likely avoid nesting I'd be reluctant to try and work element selectors into #46496 at this late stage but exploring them as a follow-up sounds good. For a fix to land in 6.2, we won't be able to rely on a new feature such as the stabilized and extended selectors API, so that might be another reason to try and sneak #49189 in. What do you think? |
Looking at the original PR from @adamziel and the associated issue - #42082, I'm more convinced that there's a mistake in the dev-note. The original PR fixes styles "leaking" from the Heading block definition to global heading elements, and it doesn't contain any changes to The |
Taking a closer look at the original PR and issue leads me to the same conclusion @Mamaduka. Nice catch! It seems like a copy-and-paste error in the dev note's snippet, just failing to remove the
Agreed. I'll close #49189 for the reasons you've pointed out 👍 |
After looking at these threads, I also believe is a mistake in the dev note. @adamziel can you verify? I think we need to correct the dev note and close this one. |
I agree, the example given should style heading elements inside heading blocks, which is not possible. I suggest we update the dev note to use the cover block as an example, as it does support heading elements. Thanks everyone. |
Reopening until the Dev Note is updated. |
cc @bph the dev note needs to be updated with this sample code @scruffian provided. Quoting it here: Let's use this example for the dev note:
This will mean that H1 elements inside a cover block will have a pink background, but all other H1s will have a blue background. |
I'm not sure the example illustrates the impact of the change to add the |
Yes, you're right, I have reopened #42082, I'm not sure how to proceed. |
Thank you, @scruffian! I will close this issue. The dev note is up to date. |
Maybe we don't need a dev note at all since we didn't actually fix anything? |
I am still experiencing the issue (WP 6.3.1) - elements node inside the core/heading block does not work at all, i.e. this does not apply specific styles to h1, h2, h3:
|
@Lovor01 Could you please create a new issue. That way more people see you are still having trouble and also probably new set of environment information. |
Thanks for providing the theme.json snippet @Lovor01 👍
Earlier in this issue's discussion, it was noted that the heading block didn't yet support "per-level" element styling. When creating the new issue as @bph suggested, it might need to be as an enhancement or feature request. |
Reported here: #55417 |
Description
Originally reported on Trac 57904.
As reported in the Miscellaneous Editor changes in WordPress 6.2, one should be able to style the h1-h6 elements of a core/heading block differently to the global h1-h6 elements via theme.json:
However, this does not work as the CSS that is generated by the WordPress style engine is as follows:
Where it should be more like:
Tested in 6.2-RC1-55503 with Twenty Twenty-Three.
Step-by-step reproduction instructions
theme.json
in your favorite code editor."styles" > "blocks"
on about line 291."blocks"
(above"core-navigation"
):.wp-block-heading-inline-css
. 🐞 Bug occurs.Expected results
The generated CSS for the
h1
should be:Actual results
The generated CSS for the
h1
is incorrectly set as:The full style (at the time of this comment):
Screenshots, screen recording, code snippet
No response
Environment info
Environment details from @hellofromtonya:
OS: macOS
Web Server: wp-env (Docker)
WordPress: 6.2-RC1-55503
Browser: Firefox 110.0.1, Edge, and Chrome
Theme: Twenty Twenty-Three
Active Plugins: None
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: