-
Notifications
You must be signed in to change notification settings - Fork 1.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
Convert header and body font sizes to rem #1527
Conversation
Co-authored-by: Adrián Bolonio <[email protected]>
Co-authored-by: Adrián Bolonio <[email protected]>
🦋 Changeset detectedLatest commit: 3f5419b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Jon Rohan <[email protected]>
That test failure is weird, (I don't think something you did wrong) going to take a closer look |
@@ -1,24 +1,30 @@ | |||
// Typography variables | |||
|
|||
@function font-size-to-rem($px, $baseFontSize) { | |||
@return ($px / $baseFontSize) * 1rem; | |||
} |
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.
We have a rem(
mixin already for this in support.
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.
I did see one in the marketing mixin directory but thought since it wasn't in the base we'd want to keep it separate? Should I use that one?
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.
It sounds like we can either use the same, or if they're in different repos, maybe clone it and maintain both at the same time, since we don't have a share library of utilities, right?
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.
One thing I'd like to see us do in the implementation is, to not use the sass mixin at all. Currently it's using some deprecated math sass functions that is blocking us from moving the build to dart-sass. If we could compute these new rem values and enter them directly that would be ideal. We could show our math in a CSS comment above each line to show that it's the px
equivalent.
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.
Here a PR where the values are already computed to rem
s: #1538
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.
The concrete benefit here is that users who change their font size in their browser will see text larger or smaller after their changes to the settings. Right now, github.com will not resize its fonts even when a user changes this setting.
Hard to say for sure without testing, but my guess is that mixing rem
with existing px
values would cause certain things to be misaligned once the user starts to change the font-size in their browser settings. It would probably be an "all or nothing" approach. There is a proposal to change all sizing here: https://github.com/github/primer/issues/41 /cc @vdepizzol
I might can try to do some sort of local test before we would merge this.
@simurai totally agree with you in the "all or nothing", where all is See as well the whole proposal here: https://github.com/github/primer/issues/257 |
I think this PR would change the computed value to body {
font-size: .875rem;
}
Here a simulation what I meant by the ☝️ above that only certain parts of the UI would be affected but some parts stay the same with a fixed px value: This is probably not 100% correct, I just overrode the font-size of a few components in DevTools to |
I believe this PR should probably be closed for now as per this comment after evaluating the proposal. I really appreciate y'all exploring this, it will be part of new work, but we want to do it the right way. Happy to discuss more about where we're heading with theming work to help you understand the direction we're heading in, and to help you with future contributions. |
From https://github.com/github/accessibility/issues/147:
From WAI:
This pull request creates a
px
torem
converter and uses that function to ensure that the body font size and the header variables outputrem
units.The concrete benefit here is that users who change their font size in their browser will see text larger or smaller after their changes to the settings. Right now, github.com will not resize its fonts even when a user changes this setting.
References
/cc @primer/ds-core