Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dynamic type text sizes not supported #18592

Closed
timhunt opened this issue Jun 21, 2019 · 31 comments
Closed

feat: dynamic type text sizes not supported #18592

timhunt opened this issue Jun 21, 2019 · 31 comments
Labels
a11y Accessibility related issues package: core @ionic/core package type: feature request a new feature, enhancement, or improvement

Comments

@timhunt
Copy link

timhunt commented Jun 21, 2019

Bug Report

Ionic version:

4.11.0

Current behavior:

On iOS, ionic apps ignore the preferred font size that the user has set in the system preferences. (Apple calls this Dynamic Type Sizes https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/typography/). Irrespective of what you set there, the text inside Ionic apps is always the same size.

(For comparison, when you build for Android, the Ionic app uses the font size the user has set in system preferences. https://material.io/design/usability/accessibility.html#layout-typography)

Expected behavior:

Ionic apps by default use the system-defined font size on all platforms.

Steps to reproduce:

On iOS:

  1. Go to Phone settings -> Display & Brightness -> Text Size, and change the system font size. (Note that the text on that page resizes immediately.)
  2. Run any Ionic app (e.g. the test app mentioned below, or the Moodle mobile app https://moodle.com/app/)
  3. Note the size of the text.
  4. Now go back to the phone settings and change to font size to something different.
  5. Go back to the Ionic app, and note that the text size has not changed.

For comparison, you can do the same thing on an Android device, and the Ionic app will change font size, and the font size will match the system text, e.g. on the settings screen.

Note that this is important for accessibility.

Related code:

I made the simplest possible Ionic/Cordova app to test this:
https://github.com/timhunt/dynamicTypeTest

When run, it just displays this screen: https://github.com/timhunt/dynamicTypeTest/blob/master/src/pages/home/home.html which has this associated JS https://github.com/timhunt/dynamicTypeTest/blob/master/src/pages/home/home.ts#L14 to display a simple dialogue if you click the button. All this just uses the standard Ionic SCSS to style things. I have not added any SCSS of my own.

The https://github.com/timhunt/dynamicTypeTest/tree/master/screengrabs folder has some screen-grabs of the app running (in an emulator, but that does not matter) with different settings for the system preferred font size. For comparison, there are also screen-grabs of a page from an Apple / Google app. This shows that on Android does a good job of picking up the system font setting, but on iOS it completely ignores the system font setting. (The Ionic default styling seems to be a good match for the smallest system font size.)

Other information:

I have done my best to research this before raising an issue (and I was not sure if this was a bug report or a feature request. I'm sorry if I got this wrong.) The thing that surprises me most is how little discussion I can find about this. I feel sure that people must have thought about this before, but I have not found much. Pretty much the only thing I found was https://forum.ionicframework.com/t/ionic-get-the-mobile-os-font-size-in-app/101498/3 and the phonegap plugin it links to. I am surprised behaviour is so different between iOS and Android.

Thanks in advance for any information you can give up. Since we want this fixed, then given some suitable guidance, we might have resources to work on a pull request. (However, I have not done any development on the Ionic framework code before.)

Cross reference: here is the bug report on the Moodle Mobile app that lead me to start investigating this: https://tracker.moodle.org/browse/MOBILE-2097.)

Ionic info:

Ionic:

ionic (Ionic CLI) : 4.11.0 (C:\Users[DELETED]\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.5
@ionic/app-scripts : 3.2.2

Cordova:

cordova (Cordova CLI) : 9.0.0
Cordova Platforms : android 8.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 4 other plugins)

System:

NodeJS : v8.14.1 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 7

Environment:

HTTP_PROXY : [DELETED]
HTTPS_PROXY : [DELETED]

@ionitron-bot ionitron-bot bot added the triage label Jun 21, 2019
@timhunt timhunt changed the title bug: Ionic on iOS ignores 'Dynamic type' user preferred font size, even though it supports on Android bug: Ionic on iOS ignores 'Dynamic type' user preferred font size, even though it supports the Android equivalent Jun 21, 2019
@liamdebeasi
Copy link
Member

Thanks for the issue! While this is an Ionic 3 application, I am going to keep this open since this is still occurring in Ionic 4.

I have created an Ionic 4 reproduction here: https://github.com/liamdebeasi/dynamic-text-ionic

@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Jun 24, 2019
@ionitron-bot ionitron-bot bot removed the triage label Jun 24, 2019
@Tsabrandon
Copy link

Is there any update on this?

1 similar comment
@NilLlisterri
Copy link

Is there any update on this?

@davidseek
Copy link

Any news?

@sathyaincampus
Copy link

sathyaincampus commented Apr 11, 2020

Are there any updates on this? Is there any workaround for showing bigger fonts on IOS. I see that comparitively my android fonts are bigger and looking good but on ios app fonts are way too smaller when generated from ionic! Would like to launch the app asap! Fast response would be much appreciated!!

@svknvs
Copy link

svknvs commented Apr 11, 2020

Yes, I also tried with iPhone and found it is not possible to increase the font size by making adjustment in the iphone settings by changing the Text Size to Larger Font Size.
It doesn't makes any change in the Ionic App. The text remains the same.

@davidseek
Copy link

I have not yet looked deeper into this.
But my suggestion would be to see if there is any variable or exposed API to get the current accessibility settings. So you know whatever the user selected.

Then I would do something like get font-size from ngStyle and use whatever I got from above to determine the value.

If there is nothing, then I suggest creating a plugin that exposes it.

@kpedrok
Copy link

kpedrok commented Sep 30, 2020

Nothing yet?

@brandyscarney brandyscarney added this to the a11y milestone Oct 2, 2020
@mastergogo
Copy link

any update on this? it is very important for our low vision users and WCAG compliance.

@toncabral1988
Copy link

Hi guys!

This did work for me.

@supports (font: -apple-system-body) {
html {
font: -apple-system-body;
}
}

@mastergogo
Copy link

Hi @toncabral, Thanks for sharing, but it didn't work for me - I added this in the global.scss file that I have and the app still does not react if I increase the text size.

@toncabral1988
Copy link

toncabral1988 commented Nov 5, 2020

Hi @toncabral, Thanks for sharing, but it didn't work for me - I added this in the global.scss file that I have and the app still does not react if I increase the text size.

in my case, it was necessary reload the application after change the text size. I know that doesn't better solution, but for now it helps me

@appstore-redphoenix
Copy link

@toncabral BTW thank you for the suggestion. By "reload the application" do you mean pause (go to backgroun) and then resume or remove the app from memory and then restart via click of icon? TIA.

@toncabral1988
Copy link

@toncabral BTW thank you for the suggestion. By "reload the application" do you mean pause (go to backgroun) and then resume or remove the app from memory and then restart via click of icon? TIA.

Yes, restart the app.

@appstore-redphoenix
Copy link

appstore-redphoenix commented Nov 6, 2020 via email

@liamdebeasi liamdebeasi added the a11y Accessibility related issues label Jul 19, 2021
@liamdebeasi liamdebeasi removed this from the a11y milestone Jul 19, 2021
@JanettHolst290490
Copy link

It is a law in my country to support accessibility in all public projects. So this is a huge problem and might be a deal breaker when choosing app framework.
Hope it gets resolved soon.

@tauhidbs23
Copy link

Hi guys!

This did work for me.

@supports (font: -apple-system-body) { html { font: -apple-system-body; } }

in my case not working , any update

@dimitriscsd
Copy link

Has there been any decision about this issue? Is it something ionic plans to sort out? If not, is there a suggested workaround, approved by Ionic?

I have seen the suggestion above and will give that a shot but it sounds like some people had success with it and some not.

@m-apsolon
Copy link

+1 on this issue.

@DalterioRaffaele
Copy link

Hi guys!

This did work for me.

https://ionicframework.com/docs/v3/native/mobile-accessibility/

After adding the plugin, i entered this code in app-component.ts

initializeApp() {
this.platform.ready().then(async () => {
if(this.platform.is('ios')){this.mobileAccessibility.usePreferredTextZoom(true);}
)}

and in app.module.ts add MobileAccessibility as providers and now iOS work with 'Dynamic type' user preferred font size, also works with capacitor.

@sedonaguy
Copy link

sedonaguy commented Aug 31, 2022

This plugin will also fix the problem (and is more lightweight):
https://capacitorjs.com/docs/apis/text-zoom

@liamdebeasi liamdebeasi changed the title bug: Ionic on iOS ignores 'Dynamic type' user preferred font size, even though it supports the Android equivalent bug: dynamic type text sizes not supported Sep 19, 2022
@JulienLecoq
Copy link

This plugin will also fix the problem (and is more lightweight): https://capacitorjs.com/docs/apis/text-zoom

But you have to kill and re-start the app to take effect, right? I don't see any listener to the preferred font-size. So that's half a solution :/

@corysmc
Copy link
Contributor

corysmc commented Nov 22, 2022

This plugin will also fix the problem (and is more lightweight): https://capacitorjs.com/docs/apis/text-zoom

But you have to kill and re-start the app to take effect, right? I don't see any listener to the preferred font-size. So that's half a solution :/

You can use the app state listener to then check the preferences, and update zoom when the app becomes active
https://capacitorjs.com/docs/apis/app#example

@JulienLecoq
Copy link

This plugin will also fix the problem (and is more lightweight): https://capacitorjs.com/docs/apis/text-zoom

But you have to kill and re-start the app to take effect, right? I don't see any listener to the preferred font-size. So that's half a solution :/

You can use the app state listener to then check the preferences, and update zoom when the app becomes active https://capacitorjs.com/docs/apis/app#example

Ah right, nice trick. But we agree that this is still a workaround and that this issue should just not exist at all.

@liamdebeasi liamdebeasi added type: feature request a new feature, enhancement, or improvement and removed type: bug a confirmed bug report labels Apr 24, 2023
@liamdebeasi liamdebeasi changed the title bug: dynamic type text sizes not supported feat: dynamic type text sizes not supported Apr 24, 2023
@slclark
Copy link

slclark commented Jun 14, 2023

I'm working on an app that is specifically for accessibility purposes. It would be preferred for the app to use the system font settings. This doesn't seem to be working at the moment. Has there been any movement on this issue?

@liamdebeasi
Copy link
Member

We plan to ship this feature. I don't have an estimate of when it will be done, but we recently finished design work for this and are now proceeding to implementation.

@staff0rd
Copy link

@liamdebeasi the implementation you speak of - is it specific to iOS as OP is suggesting? Or, will the implementation affect Android as well? I'm trying to understand whether Ionic currently has any support for system (actually browser) based text scaling in Android as I'm isolating an issue where sometimes text scaling works as expected on Android but sometimes it does not.

@liamdebeasi
Copy link
Member

Android's text scaling applies to all web content, so text in Ionic apps should already scale up and down according to the system level setting. This feature is dedicated to the iOS Dynamic Type feature which requires us to opt-in to using it.

@BrianSchwaz
Copy link

BrianSchwaz commented Oct 10, 2023

This plugin will also fix the problem (and is more lightweight): https://capacitorjs.com/docs/apis/text-zoom

But you have to kill and re-start the app to take effect, right? I don't see any listener to the preferred font-size. So that's half a solution :/

You can use the app state listener to then check the preferences, and update zoom when the app becomes active https://capacitorjs.com/docs/apis/app#example

@corysmc Can you possibly include an example code snippet of combining the listener with the appropriate logic from https://capacitorjs.com/docs/apis/text-zoom to have the application react to the font size set in the user's settings?

liamdebeasi added a commit that referenced this issue Oct 10, 2023
Issue number: resolves #24638, resolves #18592

---------

<!-- 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. -->

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?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- 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
- [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: Maria Hutt <thetaPC@users.noreply.github.com>
Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-authored-by: Shawn Taylor <shawn@ionic.io>
Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Sean Perkins <sean@ionic.io>
Co-authored-by: Sean Perkins <13732623+sean-perkins@users.noreply.github.com>
Co-authored-by: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com>
@liamdebeasi
Copy link
Member

Hi everyone,

The team is very excited to announce that this has been implemented in Ionic via #28314! We plan to release this in an upcoming minor release of Ionic. We'll have a formal announcement as well as new documentation when this feature ships.

Copy link

ionitron-bot bot commented Nov 9, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y Accessibility related issues package: core @ionic/core package type: feature request a new feature, enhancement, or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.