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

Add system-ui to the normalized font-family list #1326

Merged
merged 1 commit into from
Feb 3, 2020

Conversation

argyleink
Copy link
Contributor

https://caniuse.com/#feat=font-family-system-ui

I believe adding this future proofs the static list and supports the intent of using the platform system font more specifically.

If a browser supports system-ui, it'll choose the best font and won't cascade through the fallback list. This protects tailwind from its static list not being as up to date with platforms fonts as time goes on.

👍

https://caniuse.com/#feat=font-family-system-ui

if a browser supports system-ui, it'll choose the best font and won't cascade through the fallback list. this protects tailwind from it's static list not being as up to date with platforms fonts as time goes on.
@argyleink
Copy link
Contributor Author

I see the tests are failing! The tests don't match the change, awesome! Did I add system-ui to a generated file?
if the change sounds desirable, since it's harmless and just progressively enhances the font stack, I'm super willing to put the change into the correct spot!

@jonaskuske
Copy link

As far as I can see, your change is in the source files, but the tests compile the source and check whether the result is the same as __tests__/fixtures/tailwind-output.css and __tests__/fixtures/tailwind-output-important.css (L416). So you'll need to update these two fixtures as well in order for the tests to pass :)

@adamwathan
Copy link
Member

We deliberately don't include it currently because of this issue, which bit Bootstrap when they tried to include it:

https://infinnie.github.io/blog/2017/systemui.html

Thoughts?

@argyleink
Copy link
Contributor Author

I've got some thoughts yeah! But, I like that you're aware of why you're managing the string list instead of using system-ui, sans-serif, and I'm sure you're aware of the tradeoffs. So I'll just share my personal opinion on the matter, and y'all can let me know if I should close this PR or update the fixtures 😄

The article's tldr is that China, in a windows machine, will use the system Chinese font which isn't as great as Segoe. It's pretty much a full stop there, though one could argue Japan can run into a similar scenario. "isn't that great" can also be worded as, "the font they look at all day in that operating system." IMO, the tradeoff of never needing to manage a system font cascading string set vs managing a system font cascading string set (which is crazy hard to test and verify is giving you what you want, it's like a matrix of ui tests you'd have to run), it's pretty obvious to me which I'd pick, the future proofed system-ui keyword. It'll get better with every browser release, etc. I mean, now we have Edgium, and I'm sure they've been picky in their font choices.

The post isn't wrong, the post is nitting some super edge cases stuff, which is awesome because the web should be rad and great for everyone, but I'm not sure that the scenario presented in that post is compelling enough to tradeoff all the other benefits. Maybe 3 years ago the tradeoff was worth it, but not today.

There's this to note as well w3c/csswg-drafts#3658, where folks are tracking and talking about the issue presented in that blog post. There's a related chromium bug too, but it's a funny one. Not everyone agrees with the blog post, not everyone wants Segoe when "i want the system font" is specified in their CSS.

Hehe, sorry for the essay! This has been very fun to research, thanks for the swift feedback.

@adamwathan
Copy link
Member

Can you think of a benefit to including this a the front of the stack if we have to maintain the string list in the mean time for Firefox anyways?

@argyleink
Copy link
Contributor Author

Never having to update the string again?
Folks using beta versions of OS's will see their new freshness on tailwind sites? (like when San Francisco came out or Google Sans came out)
New operating systems or browsers can provide their optimal font that the current list doesnt know of yet/ever?

🤷‍♂

@adamwathan
Copy link
Member

Yeah fair enough, let's add it and hopefully we can delete the other cruft in a decade or two 😅

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.

3 participants