-
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
Blocks using Variations not getting styled on front end because dynamically generated IDs don't match #64216
Comments
@pinksharpii Thanks for reporting this. There were some previous issues around the class name ids mismatching, but they were fixed (an issue was reported here - #59462, a fix was made here #59535), so it's interesting to see the same kind of problem again. I've tried to reproduce it using the code snippets you've provided, but I haven't been able to spot any issues. If you could provide some more info it would help us with a reproduction:
|
Here is the block markup from one of my pages if that still helps:
|
Thanks that extra info really helps. I'll do some testing and hopefully be able to reproduce the issue. |
Actually, one more question @pinksharpii - what versions of WordPress/Gutenberg do you have installed? |
I'm on WP 6.6.1 |
Any update on this? Is it an issue that will be resolved with a future release of WP? Or is Yoast working on a fix on their end? |
I've been trying to reproduce the issue, but haven't been able to. I'll keep trying, and also reach out to some Yoast contributors to see if they have any ideas. Just to check, are all your plugins up to date? |
The plugins are up to date. I have this page. All of my variation styles are pulling in correctly - the quotes are center aligned; the headings in the three column text above the quotes are styled properly as the "heading4" style. But then I have this page where the quotes are not centered and the three Difference headings are not the right size/color. If I deactivate Yoast, everything displays correctly. If I deactivate any other plugin, it doesn't make a difference. Theme.json link for reference. Note, I changed my variation/style names from h3/h4 to heading3/heading4 respectively, just to see if the name was the problem. |
Well you can potentially ignore my two page links above because they all work now. I found this weird bug where if my page does not have a meta description or social description in Yoast, the styles don't get output appropriately. Once I put them in |
Description
I have created a few block styles for headings and paragraph blocks. As an example, this is one of each:
And then in my theme.json, I have styles defined for all of my variations under styles/blocks/variations (shortened for brevity):
As an aside note, the font sizes are custom variables I defined higher up in the json (again shortened to the necessary snippet):
Step-by-step reproduction instructions
But I'm experiencing inconsistencies in the appropriate style tag actually being output. Sometimes they render and output the correct HTML just fine:
These are h3 heading blocks styled as the h4 variation
But then other times, blocks will be output and not receive styling:
they appear correctly in the admin:
I believe the issue is the ID mapping. You can see in the Inspector above that each of those headings has a randomly generated ID like is-style-h3--1201e5b0c2adef11e541d2ddcd3f346e. And when I go look at the <style> tag that got generated for that page, the appropriate amount of declarations are there, for the correct variations, but the unique IDs don't always match up. They do sometimes (like my bottom three headings) which makes it even weirder:
Some of those IDs don't exist on my page, but it is the correct number of declarations being generated.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: