Skip to content
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-library: Fixing the html element's font-size so it will respect browser settings #1444

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

Andrew565
Copy link
Contributor

@Andrew565 Andrew565 commented Dec 24, 2024

Chromatic

https://3646-fix-browser-font-sizing--65a6e2ed2314f7b8f98609d8.chromatic.com


Description

Closes #3646

QA Checklist

N/A

Screenshots

N/A

Acceptance criteria

  • QA checklist has been completed
  • Screenshots have been attached that cover desktop and mobile screens

Definition of done

  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)

@Andrew565 Andrew565 added patch Patch change in semantic versioning css-library labels Dec 24, 2024
@Andrew565 Andrew565 self-assigned this Dec 24, 2024
@Andrew565 Andrew565 requested a review from a team as a code owner December 24, 2024 00:11
@@ -11,7 +11,7 @@ body {
}

html {
font-size: $em-base;
font-size: 100%; // Needs to be 100% to be able to grow and shrink with browser settings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed to 16px because of root font size updates related to USWDS v3 (it previously being 10px). Was this tested using Verdaccio to make sure everything still looks correct by default?

Screenshot 2024-12-26 at 8 59 08 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree here with Jami. If this hasn't been tested with Verdaccio, then it needs to be. The entire typography change initiative we completed last summer was centered around this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Andrew565 I was thinking about this more and think the 100% font-size will still work because the default font-size for most browsers should already be 16px without us needing to do anything special. That 100% value would then be based on that default. A base value of 1rem might have the same effect too. A sanity check with Verdaccio or a release candidate would ease our minds though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on testing this with Verdaccio.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with Verdaccio. Seen here is the "Very Large" font setting. The normal/medium font setting looks the same as it always does.
Screenshot 2025-01-02 at 1 02 38 PM

@Andrew565 Andrew565 requested a review from jamigibbs January 2, 2025 20:28
@jamigibbs jamigibbs removed the patch Patch change in semantic versioning label Jan 6, 2025
Copy link
Contributor

@jamigibbs jamigibbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing more testing on this! I think as long as a browser is defaulting to 16px (which most or all do?) this should work as expected.

My one last curiosity is if it should be 100% or 1rem. They both technically seem to do the same thing but I'm not sure if one would be preferred for some other cross-browser support situations that I'm not realizing.

The USWDS documentation site uses 1rem for example.

Lastly, the Sass variable in Formation overrides $em-base now seems to be unused. Maybe there is a use for it somewhere but I just want to make note that it seems like cruft at this point.

@Andrew565 Andrew565 merged commit 8f6e67b into main Jan 8, 2025
8 checks passed
@Andrew565 Andrew565 deleted the 3646-fix-browser-font-sizing branch January 8, 2025 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VA.gov doesn't respect Chrome browser font resizing anymore
4 participants