Skip to content
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

Quadrat: styles are being overridden by Gutenberg #3668

Closed
jffng opened this issue Apr 16, 2021 · 5 comments
Closed

Quadrat: styles are being overridden by Gutenberg #3668

jffng opened this issue Apr 16, 2021 · 5 comments
Labels
[Theme] Quadrat [Type] Bug Something isn't working
Milestone

Comments

@jffng
Copy link
Contributor

jffng commented Apr 16, 2021

Gutenberg's default block styles are overriding BCB's, for example in the button:

Screen Shot 2021-04-16 at 11 25 52 AM

This started after #3667

@jffng jffng added [Type] Bug Something isn't working [Theme] Quadrat labels Apr 16, 2021
@MaggieCabrera
Copy link
Contributor

This looks like a GB issue:

Block-based template PHP template
Screenshot 2021-04-16 at 18 13 38 Screenshot 2021-04-16 at 18 13 45

When the template is a FSE template the default styles for the button are loaded inline before the styles that come from theme.json. When the template is a php one, the default button styles are loaded from a stylesheet (plugins/gutenberg/build/block-library/blocks/button/style.css) and loaded before what's coming from theme.json.

@jffng
Copy link
Contributor Author

jffng commented Apr 19, 2021

Thanks @MaggieCabrera that helps, I dug into this further. The styles loading in the wrong order seems to be specific to the locate_template filter we introduced, not that it's a php template nor a child theme of a block theme.

I tried to recreate the bug unsuccessfully by doing the following:

  • Activate emptytheme
  • Add an index.php which loads the index.html (renamed to something else like block-based-index.html as to not trigger FSE) via do_blocks
  • Add a style via theme.json for example { styles.core/button.color.background: red }

The styles load in the correct order, even though it's a php template:

Screen Shot 2021-04-19 at 3 24 37 PM

I can fix this issue by adding remove_theme_support( 'block-templates' ). The downside of doing this is that it disables the ability to add new templates introduced in WordPress/gutenberg#30438

Some related Gutenberg code:

@jffng jffng linked a pull request Apr 19, 2021 that will close this issue
@MaggieCabrera MaggieCabrera added this to the Quadrat v1 milestone Apr 20, 2021
@MaggieCabrera
Copy link
Contributor

This would be solved by fixing the template inheritance in GB. I will try and look into it as well, see if we can solve it there.

@jffng
Copy link
Contributor Author

jffng commented Apr 23, 2021

@MaggieCabrera opened a fix in Gutenberg WordPress/gutenberg#31123

@jffng
Copy link
Contributor Author

jffng commented Apr 29, 2021

Closed by WordPress/gutenberg#31309

@jffng jffng closed this as completed Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Theme] Quadrat [Type] Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants