-
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
Query pagination: Styles from theme.json are being overwritten by default block styles #33871
Comments
For anyone looking at potentially picking this up, one thing I've been leveraging to fix similar issues in the navigation block (too high specificity of block styles, higher than those output by global styles), is to use |
One could, and for now should, make the CSS better. I'm not in favor of using a complex method as outlined above. If Gutenberg were to target the class of the child blocks, instead of unnecessarily target using the parent class, then the bug wouldn't exist. In the end though blocks should use the same styling mechanism as themes do: the theme.json file. This would not only be a great opportunity for dogfooding. But it also would bring block styles closer to what they are: defaults that theme authors can override. And for that the default and the override need to be provided through the same means. |
I tried using
The style from theme.json was applied. I think that both the bottom and right margins should be removed from the block style? |
I am no longer able to reproduce this, closing as fixed. |
I was able to reproduce the margin issue. Overall this is one block that struggles within theme.json ... it's far easier to define within the global |
Wouldn't that single selector be the parent query pagination block? |
@carolinan I can also reproduce this still. Was the margin supposed to be removed, as mentioned in this comment? I am testing with the same code you used above, well as with the more specific What I'm seeing: https://ocl.ink/i/AVxQqv Snippet (shortened for readability) where I'm applying margin to just about anything that could possibly work, to try and verify what you said about this working... "core/query-pagination": {
"elements": {
"link": {
"spacing": {
"margin": {
"right": "0px",
"bottom": "0"
"core/query-pagination-previous": {
"spacing": {
"margin": {
"right": "0px",
"bottom": "0"
"elements": {
"link": {
"spacing": {
"margin": {
"right": "0px",
"bottom": "0" Any chance this issue is worth re-opening? |
I have not been able to look into it, but I can re-open it. |
Is there an existing issue for this?
Have you tried deactivating all plugins except Gutenberg?
Have you tried replicating the bug using a default theme e.g. Twenty Twenty?
Description
I can't change the margin of the query pagination links using theme.json.
If I add the following code to theme.json:
It is being overwritten by the block style, and
margin-bottom: .5em;
is applied instead:Step-by-step reproduction instructions
Expected Behavior
I expect styles from theme.json to take precedence.
Current Behavior
Styles from theme.json are being overwritten by default block styles
Screenshots or screen recording (optional)
No response
Code snippet (optional)
No response
WordPress Information
5.8
Gutenberg Information
Version 11.1, 11.2
What browsers are you seeing the problem on?
Chrome
Device Information
Desktop
Operating System Information
Windows 10
The text was updated successfully, but these errors were encountered: