Skip to content

feat: add dynamic type variables - #27745

Merged
liamdebeasi merged 6 commits into
FW-4146from
FW-4513
Jul 6, 2023
Merged

liamdebeasi merged 6 commits into
FW-4146from
FW-4513

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Jul 5, 2023 •

Copy link
Copy Markdown
Contributor

Issue number: N/A


What is the current behavior?

Developers have no way of opting in to using Dynamic Type on iOS.

What is the new behavior?

  • The typography styles sets font to --ion-dynamic-type. This variable is unset initially to not cause unexpected breakages in applications. Developers must opt-in to using Dynamic Type with the following CSS:
html {
  --ion-dynamic-type: var(--ion-default-dynamic-font);
}

This will be enabled by default in an upcoming major release of Ionic.

  • Updated the testing stylesheet to opt-in to using Dynamic Type to make it easier for team members to test Dynamic Type behavior when testing on iOS devices.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: core @ionic/core package label Jul 5, 2023
Comment on lines +39 to +43
@supports (-webkit-touch-callout: none) {
html {
font: var(--ion-dynamic-type);
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

macOS now has Dynamic Type support. However, the base font size on macOS is 13px. While this aligns with the rest of the macOS design system, it does not align with Ionic components which are designed for mobile. As a result, enabling this on macOS would cause fonts to appear too small on desktop. As a result, the dynamic type font is only applied on iOS. -webkit-touch-callout detects WebKit + iOS support.

@liamdebeasi
liamdebeasi marked this pull request as ready for review July 5, 2023 17:50
@liamdebeasi
liamdebeasi requested review from a team and brandyscarney and removed request for a team July 5, 2023 17:50
@liamdebeasi

Copy link
Copy Markdown
Contributor Author

Brandy noted that I never actually provided how to test this. There are two ways:

  1. In Settings > Accessibility
setting.mp4
  1. Add a Control Center widget. I personally like this one the most because it's faster to switch between font sizes than it is switching between Safari and Settings.
cc.mp4

@brandyscarney brandyscarney left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good! I was running into an issue because I tried changing the h1 font-size in typography.scss to use rem units but it needed a full re-build to see the changes.

I tested it out using the src/components/text/test/basic test.

@liamdebeasi
liamdebeasi merged commit 937c44d into FW-4146 Jul 6, 2023
@liamdebeasi
liamdebeasi deleted the FW-4513 branch July 6, 2023 19:17
sean-perkins pushed a commit that referenced this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants