-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
CSS coding standards for font-weight #11715
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.
According to https://css-tricks.com/almanac/properties/f/font-weight/, "bold" maps to 700, not 600. Also, let's make sure we test this visually before we merge — I'm, 73% sure that there are specific instances where 600
was used instead of bold
, because the semi bold version was desired.
Thanks so very much for this PR! Really appreciate it. I left a comment that we should make sure to visually test that this doesn't change anything, as we're past the UI freeze. Bold is supposedly not the same as 600, so let's just be absolutely sure. If you are busy and need help wrapping up those changes, let me know and I can volunteer to fix this up. |
Good question. His reasoning is that core uses 600 for bold, which certainly makes sense from a consistency point of view. Let me take this for a quick visual testing spin and revisit. |
Maybe its a typo, the link to the Coding standards says bold -> 700: https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/#values |
Not a typo, as mentioned above:
|
I saw this link and I'd confused... 😕 |
Background: core used "Open Sans" where 600 mapped to the Open Sans "semi bold" weight. Most of the CSS in core still uses "600". Actually, it depends on the font. If the font doesn't provide a "600" font weight, browsers will fall back to bold anyways. See also #5848 More importantly, see https://core.trac.wordpress.org/changeset/37740 |
Thanks for the history. I just took this this for a visual spin, and my aging eyes see no visual regressions. As such, I'm ready to approve this PR. But per comments by @ntwb and @Soean let me know what you think is the best approach here. 600 and 700 are both fine with me — just need to know we're doing the right thing, since it's about code quality. |
To my knowledge 600 is the standard in core. The handbook should be updated. For a final word, you may want to ask @helen |
No need for any final words, 600 sounds right to me. Just want to verify with @ntwb per the above. Would also be good to track somewhere to update the handbook, just so it doesn't fall off the radar. |
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.
In effort to keep things moving, approving this per discussion points.
If this was in error, and it should be 700 instead of 600, feel free to ping me and I'll submit a PR to change that.
Thanks @afercia, I think the key part of that commit you cited is this:
So I guess we should perform an audit of the system font stack WordPress uses to determine which system fonts include font weight 700, or only 600. Per the above, happy to see this merged as is, we should follow this up on Trac IMHO |
Why not use variables instead of those hardcoded values?
Yes, but let's consider my previous comment. |
These shouldn't really change value, ever Plus, I think this would just be weird, not for any legitimate reason though /shrug -font-weight: bold;
+font-weight: $bold; Actually, the legit reason would be I'd have to update the stylelint |
Description
I've updated font-weight for numeric values (normal -> 400 and bold -> 600)
Closes: #11687
How has this been tested?
This has been tested with "npm test" and manually on Chrome and Firefox
Types of changes
Bug fix
Checklist: