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
Query pagination: Styles from theme.json are being overwritten by default block styles #33871
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Block] Query PaginationAffects the Query Pagination Block - used for pagination within the Query Loop Block[Type] BugAn existing feature does not function as intended
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 :where to lower the specificity of the block styles. This codepen outlines the principle: https://codepen.io/joen/pen/abJVrGX
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.
The style from theme.json was applied.
When there was no style in theme.json, the block default of 0px margin was used instead of the block specific styles.
I think that both the bottom and right margins should be removed from the block style?
In the editor, this margin is already overridden. The parent has a gap style which already separates the next/previous and the numbers.
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 style.css as some items, such as the current page number, cannot be styled. Furthermore, it's odd having to replicate styles for the next and previous elements when they will almost always be the same, right? Might make more sense just to have this as a single selector.
@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 core/query-pagination.
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...
Thanks for the report and the patience here! The hardcoded margins on the pagination children were removed in #64874 (WordPress 6.7), so theme.json spacing is no longer overridden. Closing, but feel free to reopen if you still see it on a recent version.
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Block] Query PaginationAffects the Query Pagination Block - used for pagination within the Query Loop Block[Type] BugAn existing feature does not function as intended
Activity
jasmussen commentedon Aug 4, 2021
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
:whereto lower the specificity of the block styles. This codepen outlines the principle: https://codepen.io/joen/pen/abJVrGXfklein-lu commentedon Aug 7, 2021
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.
carolinan commentedon Sep 17, 2021
I tried using
The style from theme.json was applied.
When there was no style in theme.json, the block default of 0px margin was used instead of the block specific styles.
I think that both the bottom and right margins should be removed from the block style?
In the editor, this margin is already overridden. The parent has a
gapstyle which already separates the next/previous and the numbers.carolinan commentedon Jul 25, 2022
I am no longer able to reproduce this, closing as fixed.
badg0003 commentedon Jul 3, 2023
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
style.cssas some items, such as the current page number, cannot be styled. Furthermore, it's odd having to replicate styles for the next and previous elements when they will almost always be the same, right? Might make more sense just to have this as a single selector.carolinan commentedon Jul 3, 2023
Wouldn't that single selector be the parent query pagination block?
graylaurenm commentedon Jul 30, 2023
@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
core/query-pagination.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...
Any chance this issue is worth re-opening?
carolinan commentedon Aug 1, 2023
I have not been able to look into it, but I can re-open it.
ntsekouras commentedon Sep 3, 2026
Thanks for the report and the patience here! The hardcoded margins on the pagination children were removed in #64874 (WordPress 6.7), so theme.json spacing is no longer overridden. Closing, but feel free to reopen if you still see it on a recent version.