Fix weird character rendering on Windows with Japanese locale - #20318
Conversation
Replace `ui-sans-serif` and `system-ui` with the following set of fonts: - `-apple-system` - `BlinkMacSystemFont` - 'Segoe UI' - Roboto - 'Helvetica Neue' - 'Noto Sans' - Arial For most peole this will look exactly the same, but it's for places like Windows where a different font is used for `system-ui` in case your machine is using a Japanese locale for example. Then the font used is 'Yu Gothic UI' which is the font that has bugs. You could argue that it's a bug in that font and even an OS bug for not providing a proper font for `system-ui`.
736130c to
d3ba8c0
Compare
Confidence Score: 4/5Safe to merge — the change is a direct substitution of a well-known font stack (Bootstrap v4/v5) for the system-ui-based one, and it is consistent across every affected file. The new font list fixes a real rendering defect on Windows CJK locales and the approach is validated by prior art (Starlight, VitePress). The main residual uncertainty — which the author openly acknowledges — is that dropping system-ui might produce subtly different rendering on exotic or future OS/locale combinations that are hard to test exhaustively. All snapshot tests are updated consistently, so there is no snapshot drift risk. No files require special attention; all changed files are in sync with the new font stack. Reviews (1): Last reviewed commit: "update CHANGELOG" | Re-trigger Greptile |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (7)
WalkthroughUpdated Tailwind’s default sans-serif font stack to use explicit platform fonts, including Apple, Windows, Android, and common fallback families, replacing 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
|
This change broke Tailwind defaults in a patch release: #20348 |
Tailwind CSS v4.3.3 changed the default `--font-sans` value to fix broken character rendering on Windows with CJK locales (tailwindlabs/tailwindcss#20318), but the docs still show the previous`ui-sans-serif, system-ui, sans-serif` stack. Update the `font-family` quick reference and the four `theme.css`examples on the theme page to match the stack that actually ships (tailwindlabs/tailwindcss/packages/tailwindcss/theme.css). Reported in tailwindlabs/tailwindcss#20348.
This PR fixes an issue where some characters are incorrectly rendered on Windows with the Japanese locale.
This is arguably a bug in the font that's loaded by Windows when it encounters
system-ui. But waiting for fixes there might ... take a while.Another option is to not change the defaults in Tailwind CSS and instead let the users that support different locales implement a fallback by overriding the
--font-sansvariable.The biggest reason for me to not change it in Tailwind CSS is that it requires us to know what the (proper) fallback fonts need to be on a per OS basis.
But the main reason why I did want to make the change is that MDN says this about the
system-uifont:There are PRs in other big projects that made this kind of change as well. E.g.:
The reasoning for getting rid of
ui-sans-serifis twofold:ui-sans-serif, then we will run into the same issue again.Fixes: #19767
Fixes: #19768
Test plan
system-uiis not used anymore, so the bug doesn't happen