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

Update font-stack in design tokens #136

Merged
merged 12 commits into from
Apr 1, 2022
Merged

Conversation

didoo
Copy link
Contributor

@didoo didoo commented Mar 30, 2022

๐Ÿ“Œ Summary

This resolves #128 - see the issue for more details on what problem we're trying to solve with this PR

๐Ÿ› ๏ธ Detailed description

In this PR I have:

  • updated the font-stack design tokens in โ€œtypographyโ€
    • removed SF Pro Display/Text in Display/Text
      • as noticed by @heatherlarsen it was useless, -apple-system, BlinkMacSystemFont already do the job
    • replaced Segoe UI Display/Text with Segoe UI in Display/Text
    • added Helvetica, Arial, sans-serif to the sans block in Display/Text
      • we initially added also Roboto but then decided to remove it (reference)
    • removed Ubuntu for the linux platform
      • reason is that apparently can cause issues (reference)
    • added explicit emoji support for Display/Text
    • replaced SF Mono with ui-monospace in Code
    • added Menlo to Code
  • re-generated design tokens in output

๐Ÿ‘€ How to review

๐Ÿ‘‰ Review by files changed

Reviewer's checklist:

  • +1 Percy
  • Confirm that PR has a changelog update via Changesets if needed

๐Ÿ’ฌ Please consider using conventional comments when reviewing this PR.

๐Ÿšจ Percy visual regression tests failing

All the visual regression tests in Percy are failing. There is not much we can do. The reasons are multiple:

  • The tests for Chrome/Firefox/Edge are likely running on some Linux or Windows machine/emulator, so having changed the font stacks (eg. Segoe + Roboto/Helvetica/Arial) is likely to cause a different font to be used on these OS.
  • Safari was not activated as target in Percy, so we can't see if the tests are failing on Mac/Safari but I did a test in my local machine, and the Display and Body sans text is exactly the same, while the difference is only on the Code monospace (and it's for the reason mentioned above, that the previous implementation was not using the right font declaration).

- replaced `Segoe UI Display/Text` with `Segoe UI`
- added `Roboto, Helvetica, Arial, sans-serif` to the `sans` block
- added explicit emoji support for `Display/Text`
- added `Menlo` to `Code`
@vercel
Copy link

vercel bot commented Mar 30, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

hds-flight-website โ€“ ./

๐Ÿ” Inspect: https://vercel.com/hashicorp/hds-flight-website/B7MqaevS3u6NWERJdJeLq9CxUZpc
โœ… Preview: https://hds-flight-website-git-128-update-design-token-74989e-hashicorp.vercel.app

hds-components โ€“ ./

๐Ÿ” Inspect: https://vercel.com/hashicorp/hds-components/EHTgbQR26yJiPioHn2fj7TWK4EQK
โœ… Preview: https://hds-components-git-128-update-design-tokens-fo-e82ffd-hashicorp.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Mar 30, 2022

๐Ÿฆ‹ Changeset detected

Latest commit: e8a860c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@hashicorp/design-system-components Minor
@hashicorp/design-system-tokens Minor

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

@vercel vercel bot temporarily deployed to Preview โ€“ hds-flight-website March 30, 2022 10:45 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-components March 30, 2022 10:45 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-components March 30, 2022 10:56 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-flight-website March 30, 2022 10:56 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-flight-website March 30, 2022 11:45 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-components March 30, 2022 11:45 Inactive
@MelSumner
Copy link
Contributor

[question] does design need to sign off on this decision?

@didoo
Copy link
Contributor Author

didoo commented Mar 30, 2022

[question] does design need to sign off on this decision?

I prefer to have a second eye on this (expecially considered that @heatherlarsen has a good eye for details, and background as front-end developer too) :)

@heatherlarsen
Copy link
Contributor

Was doing a bit of research on this as the list is getting pretty lengthy and wanted to share an article I found about GitHub's explorations with font stacks. This article is a bit dated, but it's still linked on the Primer website, so seems relevant. I specifically wanted to note that GitHub originally started by including Roboto, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", but later removed them because of feedback they received from Linux users: "Linux system fonts seem to be rather large and clunky, and their system fonts so inconsistent across distros"

Thankfully we're not including that full list, but what do you think about removing Roboto, Ubuntu from the list in an effort to avoid the same issues? Or is this something we want to take away as a potential research topic for the future?

Also wondering if we need to specifically call out "SF Pro Display" and "SF Pro Text"? I may be misinterpreting this, but it seems like we may be able to just rely on -apple-system, BlinkMacSystemFont: Apple Typography Guidelines

@vercel vercel bot temporarily deployed to Preview โ€“ hds-flight-website March 31, 2022 09:09 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-components March 31, 2022 09:09 Inactive
- โ€œSF Pro Display/Textโ€ was useless, `-apple-system, BlinkMacSystemFont` already do the job
- โ€œUbuntuโ€ and โ€œRobotoโ€ can cause issues (see this https://markdotto.com/2018/02/07/github-system-fonts/)
@vercel vercel bot temporarily deployed to Preview โ€“ hds-flight-website March 31, 2022 09:30 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-components March 31, 2022 09:30 Inactive
@didoo
Copy link
Contributor Author

didoo commented Mar 31, 2022

@heatherlarsen I have updated the font stack according to your suggestions, they all make sense. As it is now, our font stack will be almost identical to the one in GitHub, so we should be confidently safe enough :)

Copy link
Contributor

@ashleemboyer ashleemboyer left a comment

Choose a reason for hiding this comment

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

This looks good to me! โœจ It'll be awesome to use these in DevDot. ๐ŸŽ‰

@didoo
Copy link
Contributor Author

didoo commented Mar 31, 2022

@heatherlarsen if you can have a last look and give me thumbs up, I can merge and release these changes

--token-typography-font-stack-text: -apple-system, BlinkMacSystemFont, SF Pro Text, Segoe UI Text, Ubuntu, sans-serif;
--token-typography-font-stack-code: SF Mono, Consolas, Ubuntu Mono, monospace;
--token-typography-font-stack-display: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
--token-typography-font-stack-text: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
Copy link
Contributor

@heatherlarsen heatherlarsen Mar 31, 2022

Choose a reason for hiding this comment

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

[question] --token-typography-font-stack-display and --token-typography-font-stack-text are now the same. Are we able to simplify them down to the same token or no?

Copy link
Contributor Author

@didoo didoo Mar 31, 2022

Choose a reason for hiding this comment

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

I would prefer not to, if that's OK for you. Reason being that 1) would require some refactoring on our side (not big deal) but potentially from our consumers (not great) but more importantly that 2) if in the future we want to differentiate for some reasons the two, having two separate tokens will make it seamless (we just release a new version of the package and that's it) while if we have a single token will require to manually check all the use cases where it's used and decide if it's a text or a display (maybe it's easy, maybe it's a nightmare).

The cost of maintaining both is zero now (there's not even performance problems). The potential cost of unifying them is unknown (and in the worst case could be pretty high).

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, thanks for clarifying.

Copy link
Contributor

@heatherlarsen heatherlarsen left a comment

Choose a reason for hiding this comment

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

lgtm!

@vercel vercel bot temporarily deployed to Preview โ€“ hds-flight-website April 1, 2022 09:02 Inactive
@vercel vercel bot temporarily deployed to Preview โ€“ hds-components April 1, 2022 09:02 Inactive
@didoo didoo merged commit 2da440f into main Apr 1, 2022
@didoo didoo deleted the 128-update-design-tokens-font-stack branch April 1, 2022 09:22
@github-actions github-actions bot mentioned this pull request Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synchronize CSS font-stack between DevDot and the design system
4 participants