-
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
Latest Comments Block: Prefer relative units #24409
Latest Comments Block: Prefer relative units #24409
Conversation
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.
Thanks for your work @aristath! - I believe in GB px
are preferred as we can see from variables file for example:
$default-font-size: 13px; |
Having said that, it's not my area of expertise so I added the design feedback
label to be looked better.
Perhaps for our own UI components it may make sense to use |
Thanks Nick 👍 Most of the CSS-variables use pixels for the editor itself, not so much for the frontend styles. The remaining cases where pixels are used, are cases that need to be addressed. In multiple meetings with the themes team, the editor team, and members of the a11y team, the consensus always is that we want/need to start moving away from absolute units on all front-facing styles for blocks. |
All good thoughts, and I'd generally agree. Many of the Gutenberg px values are for block UI (though a few are for the unstyled editing canvas). For anything that touches that, Nik is right. However aristath and Zeb are right when it comes to content of Principles and values here, are to provide the minimum CSS and styling in order to provide a nice block for a theme that doesn't style it, and otherwise be as adaptive as possible to the surroundings. I.e. try and inherit fonts and line heights, be careful with colors, all that stuff. In that vein, high level, I do agree this is a good change. I wonder though, whether There's probably a long term solution here involving global styles, but as far as the near term solution, that seems like the one to agree on. @kjellr if you have time, do you have any insights? I'm happy to defer here as well. |
Thanks @jasmussen! Regarding Using |
Oh, that's an important one to think about. While we mean for that to be a passing issue (we need to tackle at the root what casues CSS bleed) it is nevertheless real and present. If you're okay waiting for our friend Kjell to wake up to the pings, I'd still appreciate his voice. However the above argument definitely ticked the weight towards rem over em for me. |
Thanks for the ping. I need to reflect on this a little bit more, but here are some initial thoughts: In general I agree that it makes sense to use My main hesitation isn't around this PR, but more around the larger implications of doing this in all the other PRs... while switching to relative units is clearly the way this should be done, unfortunately it wasn't done from day one. That makes me a little concerned about how cumulative changes like this might end up having a noticeable difference on exsiting sites (in themes where Also on my mind is the fact that many themes (both Twenty Twenty and Twenty Nineteen for example) modify the value of |
Great thoughts, Kjell, thanks so much. Your explanation of the challenges with existing code and themes makes me think of this iframe PR: #21102 — if you read the conversation there, it becomes clear that it's both feasible, but also a giant change, and one that is likely to break a few things if/when it comes to pass. It's also a PR that incidentally should solve the CSS bleed problem, and make ems work both front and back. I wonder if these changes should be bundled with such an iframe change, so that instead of lots of little annoying changes, there will be one big one, that happens to also come with a slew of very real and tangible benefits? |
I could easily do a single big PR instead of multiple small ones... Would be easier for me, but the reason I didn't do it is because we not only have to write the code, we also need to review it. Smaller incremental changes are easier to digest, review and merge 😅 |
It might be helpful even just to check out a draft PR that pulls in a lot of these changes — just so we can assess the overall impact. For example, the more I think about this one...
... the more I think that might be a problem. In this PR for instance, that would mean that for Twenty Twenty, all the changes in this PR would have a base |
Done, see #24523 👍 |
Combined with other PRs in #24523 |
Changes the Latest Comments block to use relative instead of absolute units.
This will make theming easier, especially in cases where the theme changes the default font-size for the document. Sizes will now auto-scale, and themes won't need to rewrite styles, they can just enqueue the core styles.