Skip to content

feat(a11y): add dynamic font scaling - #28314

Merged
liamdebeasi merged 58 commits into
feature-7.5from
FW-4146
Oct 10, 2023
Merged

feat(a11y): add dynamic font scaling#28314
liamdebeasi merged 58 commits into
feature-7.5from
FW-4146

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Oct 9, 2023

Copy link
Copy Markdown
Contributor

Issue number: resolves #24638, resolves #18592


What is the current behavior?

Developers have requested that Ionic Framework support the dynamic type feature on iOS for accessibility purposes. Ionic applications do not respond to font scaling on iOS which can create inaccessible applications particularly for users with low vision. Ionic apps on Android devices currently support the Android equivalent due to functionality in the Chromium webview.

Developers have also requested a way of adjusting the fonts in their Ionic UI components consistently.

What is the new behavior?

  • Ionic components now use rem instead of px where appropriate. This means devs can change the font size on html and the text in supported Ionic components will scale up/down appropriately
  • Add support for Dynamic Type on iOS (the iOS version of Dynamic Font Scaling)

Does this introduce a breaking change?

  • Yes
  • No

Other information

liamdebeasi and others added 30 commits July 6, 2023 15:17
Issue number: N/A

---------

## What is the current behavior?
The datetime button does not support dynamic type.

## What is the new behavior?
Adds support for dynamic type by converting `font-size` to use `rem`
units and adding an ellipsis to text when the size is too large.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No


## Other information

Dynamic type can be enabled with the following CSS:

```css
html {
  --ion-dynamic-type: var(--ion-default-dynamic-font);
}
```
Adds support for dynamic type by converting `font-size` to use `rem` units and setting a `max-size` which matches native iOS.
- Adds support for dynamic type by converting `font-size` to use `rem` units.
- Updates the button width/height for icon only buttons in `md` to use `rem` units to scale the icon larger
- Adds test for scaling the font which checks default buttons, clear buttons (because they use a different `font-size`), buttons with an icon, and a button containing only an icon
Issue number: N/A

---------

<!-- 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 current behavior?
<!-- Please describe the current behavior that you are modifying. -->
The chip component does not support dynamic type.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
The chip component supports dynamic type, has a dynamic height, has min
and max font sizes in `ios` mode, and has a screenshot test.

### md mode

Small md mode:
<img width="1368" alt="md-small"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/4466c1b6-6d01-4ec8-8de9-0eb71fa45223">


Medium md mode:
<img width="1371" alt="md-medium"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/c51c324e-a3b7-486b-9f68-84b0e4146570">


Large md mode:
<img width="1369" alt="md-large"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/166e1229-96b7-4270-9ef2-4c708776691e">


 
### ios mode
Small ios mode:
<img width="1371" alt="ios-small"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/de240058-5fe5-4387-8481-d695950853db">


Medium ios mode:
<img width="1371" alt="ios-medium"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/c63db4be-e813-4917-a525-02ec456849ea">


Large ios mode:
<img width="1370" alt="ios-large"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/3479f619-82c8-4645-85f7-2725ea43de00">



## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

This also fixes an existing bug that the contents of a chip could get
smooshed if the chip doesn't have enough horizontal space for its
contents.

### Before
<img width="253" alt="rStll"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/9a8f4c30-ceef-4fe1-a600-38b2f01c4e68">


### After
<img width="253" alt="Screenshot 2023-08-02 at 5 00 39 PM"
src="https://github.com/ionic-team/ionic-framework/assets/14926794/e82e17c3-91e3-4089-a57b-16c7d7b386fb">

---------

Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
Adds support for dynamic type by converting `font-size` to use `rem` units and setting a max `font-size` which matches native iOS.
Adds support for dynamic type by converting `font-size` to use `rem` units and setting a min `font-size` which matches native iOS.
Adds support for dynamic type by converting `font-size` to use `rem` units.
Adds support for dynamic type by converting `font-size` to use `rem` units.
Adds support for dynamic type by converting `font-size` to use `rem` units and adds a min and max `font-size` for `ios`.
Issue number: N/A

---------

<!-- 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 current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The dynamic type feature branch screenshots are out of sync with the
updated state from changes on `main`.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Regenerates update screenshot diffs for the dynamic type feature
branch with the latest changes from `main`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Co-authored-by: ionitron <hi@ionicframework.com>
Adds support for dynamic type by converting `font-size` to use `rem` units. Upgrades the `sass` version to `1.33.0` to support this change.
Adds support for dynamic type by converting `font-size` to use `rem` units and adds a min and max `font-size` for `ios`.
Issue number: N/A

---------

<!-- 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 current behavior?
<!-- Please describe the current behavior that you are modifying. -->
ion-textarea does not support dynamic type

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- ion-textarea does support dynamic type

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Mostly, dynamic type for textarea was already supported. Only the
bottom-content had a static size. All other font sizes were all already
relative.

Note: Textareas do not currently look correct when they are in an item,
because #27989 has not yet merged. Once that PR is merged, the font
sizes within textareas will be relative to the item sizes, and both will
scale appropriately. If preferred, I can base this PR off branch FW-4432
instead.

---------

Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
liamdebeasi and others added 13 commits September 26, 2023 16:47
chore: sync with main
Co-authored-by: ionitron <hi@ionicframework.com>
…8209)

Converts some of the `rem` units for dynamic font scaling to use the `dynamic-font` functions that didn't exist when these were implemented.
Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
Co-authored-by: ionitron <hi@ionicframework.com>
chore: sync with feature-7.5
@liamdebeasi liamdebeasi changed the title Fw 4146 feat(a11y): add dynamic font scaling Oct 9, 2023
@github-actions github-actions Bot added the package: core @ionic/core package label Oct 9, 2023
Issue number: N/A

---------

<!-- 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 current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The Dynamic Font Scaling branch was using an outdated version of
Ionicons which did not support Dynamic Font Scaling. There were no
visual diffs because we typically override the size of the icon
internally, but still good to be on the latest version.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Ionic Core uses Ionicons 7.2 internally

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
@liamdebeasi
liamdebeasi marked this pull request as ready for review October 10, 2023 17:41

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@liamdebeasi
liamdebeasi merged commit f806781 into feature-7.5 Oct 10, 2023
@liamdebeasi
liamdebeasi deleted the FW-4146 branch October 10, 2023 21:38
@matfantinel

Copy link
Copy Markdown

This was a breaking change to the app I work on. Suddenly all Ionic controls got too small and tweaking the font-size in the html tag made my other styles (that use rem) too big. Definitely not expected from a minor version bump. Not cool 😔

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.

8 participants