Skip to content

Commit

Permalink
feat(preflight): simplify sans-serif font stack (#11748)
Browse files Browse the repository at this point in the history
* feat(preflight): simplify sans-serif font stack

`-apple-system` and `BlinkMacSystemFont` were historically needed for
IE11 and chakra-based Edge (The one that wasn't chromium-based).

https://caniuse.com/font-family-system-ui has more details around it.

* further simplify `font-family`

* update tests

* update changelog

---------

Co-authored-by: Robin Malfait <[email protected]>
  • Loading branch information
2 people authored and thecrypticace committed Dec 5, 2023
1 parent 394f6e9 commit d0d2ba1
Show file tree
Hide file tree
Showing 10 changed files with 304 additions and 313 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `appearance-auto` utility ([#12404](https://github.com/tailwindlabs/tailwindcss/pull/12404))
- Add logical property values for `float` and `clear` utilities ([#12480](https://github.com/tailwindlabs/tailwindcss/pull/12480))

### Changed

- Simplify the `sans` font-family stack ([#11748](https://github.com/tailwindlabs/tailwindcss/pull/11748))

## [3.3.6] - 2023-12-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/css/preflight.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ html,
-webkit-text-size-adjust: 100%; /* 2 */
-moz-tab-size: 4; /* 3 */
tab-size: 4; /* 3 */
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
}
Expand Down
7 changes: 0 additions & 7 deletions stubs/config.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,6 @@ module.exports = {
sans: [
'ui-sans-serif',
'system-ui',
'-apple-system',
'BlinkMacSystemFont',
'"Segoe UI"',
'Roboto',
'"Helvetica Neue"',
'Arial',
'"Noto Sans"',
'sans-serif',
'"Apple Color Emoji"',
'"Segoe UI Emoji"',
Expand Down
5 changes: 2 additions & 3 deletions tests/basic-usage.oxide.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,8 @@
vertical-align: middle;
}
.font-sans {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
Noto Color Emoji;
font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}
.text-2xl {
font-size: 1.5rem;
Expand Down
5 changes: 2 additions & 3 deletions tests/basic-usage.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,8 @@
vertical-align: middle;
}
.font-sans {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
Noto Color Emoji;
font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}
.text-2xl {
font-size: 1.5rem;
Expand Down
6 changes: 2 additions & 4 deletions tests/kitchen-sink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ crosscheck(({ stable, oxide }) => {
stable.expect(result.css).toMatchFormattedCss(css`
.theme-test {
color: #3b82f6;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji,
font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}
@media (min-width: 1024px) {
Expand Down Expand Up @@ -813,8 +812,7 @@ crosscheck(({ stable, oxide }) => {
oxide.expect(result.css).toMatchFormattedCss(css`
.theme-test {
color: #3b82f6;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji,
font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}
@media (min-width: 1024px) {
Expand Down
5 changes: 2 additions & 3 deletions tests/raw-content.oxide.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,8 @@
vertical-align: middle;
}
.font-sans {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
Noto Color Emoji;
font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}
.text-2xl {
font-size: 1.5rem;
Expand Down
5 changes: 2 additions & 3 deletions tests/raw-content.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,8 @@
vertical-align: middle;
}
.font-sans {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
Noto Color Emoji;
font-family: ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji,
Segoe UI Symbol, Noto Color Emoji;
}
.text-2xl {
font-size: 1.5rem;
Expand Down
4 changes: 2 additions & 2 deletions tests/resolveConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ crosscheck(() => {
'grey-lighter': '#f1f5f8',
},
fonts: {
sans: ['system-ui', 'BlinkMacSystemFont', '-apple-system', 'Roboto', 'sans-serif'],
sans: ['system-ui', 'Roboto', 'sans-serif'],
serif: ['Constantia', 'Lucida Bright', 'Georgia', 'serif'],
},
screens: {
Expand All @@ -176,7 +176,7 @@ crosscheck(() => {
'grey-lighter': '#f1f5f8',
},
fonts: {
sans: ['system-ui', 'BlinkMacSystemFont', '-apple-system', 'Roboto', 'sans-serif'],
sans: ['system-ui', 'Roboto', 'sans-serif'],
serif: ['Constantia', 'Lucida Bright', 'Georgia', 'serif'],
},
screens: {
Expand Down
Loading

0 comments on commit d0d2ba1

Please sign in to comment.