Skip to content

Commit 807c701

Browse files
BenOsodracgnbm
andauthored
fix(typography): add missing rule on ionic theme for ios dynamic type (#31031)
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> This pull request updates the Ionic typography styles to better support dynamic font sizing on iOS devices. The main focus is on enabling Dynamic Type support conditionally for iOS, while preserving the default font family settings elsewhere. This was already present for md/ios files, but when doing the new Ionic Theme, this particular rule was lost. **iOS Dynamic Type Support:** * Added a CSS `@supports` block to apply a dynamic font size using the `--ion-dynamic-font` variable for iOS devices, leveraging the `-webkit-touch-callout` feature detection. This ensures Dynamic Type is only enabled on iOS, improving accessibility and user experience for those users. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> --------- Co-authored-by: Gonçalo M. <goncalo.martins@outsystems.com>
1 parent 253329b commit 807c701

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

core/src/css/ionic/core.ionic.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323

2424
html {
25-
--ionic-dynamic-font: -apple-system-body;
25+
--ion-dynamic-font: -apple-system-body;
2626
}
2727

2828
body {

core/src/css/ionic/typography.ionic.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
@use "../../themes/ionic/ionic.globals.scss" as globals;
22

3-
// TODO(ROU-10833): add font loading solution here, as a @font-face, base64 or cdn
43
html {
54
font-family: globals.$ion-font-family;
65
}
76

7+
// Dynamic Type is an iOS-only feature, so
8+
// this should only be enabled on iOS devices.
9+
@supports (-webkit-touch-callout: none) {
10+
html {
11+
font: var(--ion-dynamic-font, 16px #{globals.$ion-font-family});
12+
font-family: globals.$ion-font-family;
13+
}
14+
}
15+
816
body {
917
@include globals.typography(globals.$ion-body-md-regular);
1018
}

0 commit comments

Comments
 (0)