-
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
Add a box-sizing border-box to lists #39895
Conversation
Size Change: +72 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
Yeah, I think this is fair and I believe when we talked about adding a blanket rule for the whole site we decided against it in favor of adding them block by block should it be needed and this seems clearly the case. I'll test in a few themes tomorrow in any case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, didn't see any changes on the themes I tested, including twenty ten
Cool, just as you acknowledged it would, this broke one of my client's publicly facing website's styling. Why was it necessary to do this? The theme in question uses a very popular reset method:
and then uses a section element to scope to box-sizing:content for that whole component. Your change is too global, and very inconsiderate. |
Hey @WraithKenny I'm sorry this broke your theme. Unfortunately, this was necessary as it's a bug fix. Without any theme provided styles, the list block by default was not aligned properly (its width grew) if you just apply a random background. |
This could've probably been scoped, by using the same inherit technique and setting border-box to an appropriate class. It's almost never necessary to inject a global style. Besides, there's countless "bugs" like that that have been ignored so far; hopefully, you don't resort to this kind of fix for all of them. |
Indeed, but the list block doesn't have a dedicated classname, and the bug is not specific to backgrounds, it's a bug that shows up every time you add padding to a list without any scoped selector. |
What?
I noticed that when you apply padding to lists (whether via theme.json or by just picking a background for the list block), the width of the block is impacted and the block becomes unaligned with the rest of the content.
That's because the list block is missing
box-sizing: border-box;
CSS rule. This PR adds this PR to the default style of lists.This can be seen as a breaking change for themes as it might impact all of them. That said, I expect that most themes already do
box-sizing: border-box
for most of their elements. So I think the impact will be small and mostly bug fixes but I'd like to know what you all think.Also, right now the list block doesn't support "padding" block support but if we decide to add at some point, the bug will be even more visible, so might as well fix it now.
Testing Instructions
1- Add a list block
2- Choose a background color
3- Notice that the list block doesn't "grow", it's aligned with the rest of the content.
cc @WordPress/theme-team @WordPress/block-themers