[TIMOB-25847] iOS: Accessibility support for Dynamic Type
GitHub Issue | n/a |
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-01-07T14:41:44.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.0.0 |
Components | iOS |
Labels | 2019-cl |
Reporter | Victor Vazquez Montero |
Assignee | Unknown |
Created | 2018-03-07T17:28:02.000+0000 |
Updated | 2020-01-07T14:41:44.000+0000 |
Description
Feature Request:
Trying to use the accessibility options in iOS: Specifically the option to use larger text (Dynamic Type) but the changes are not applied to the app.
Setting the font size to use "sp" as unit identifier for the font size which works on Android but not in iOS.
font: {
fontSize: '16sp'
}
In the fontSize documentation it says: "iOS ignores any unit specifier after the size value."
when changing font size in accessibility options the alert dialogs have the font size change but nothing else.
Can we implement Dynamic Type support so that font size is also changed within the app?
Attachments
File | Date | Size |
app.zip | 2019-11-22T19:10:42.000+0000 | 5125641 |
Hey [~nderzhak] would you be the write person to assign for this?
Some notes here: * We already support one portion of it - the [textStyle](http://docs.appcelerator.com/platform/latest/#!/api/Font-property-textStyle) properties that scale automatically * Since iOS, native developers can listen to the [
UIContentSizeCategoryDidChangeNotification
](https://developer.apple.com/documentation/uikit/uicontentsizecategorydidchangenotification) notification that notifies developers about font-size changes. We could expose the same on the Ti.UI.Label namespace, e.g. as an event like this:* For iOS 10+, iOS started to realize the dynamic font management is bad, so they came up with [
adjustsFontForContentSizeCategory
](https://developer.apple.com/documentation/uikit/uicontentsizecategoryadjusting/1771731-adjustsfontforcontentsizecategor?language=objc) which is a boolean that can be set for each label instead of globally. Read more about this [here](https://useyourloaf.com/blog/auto-adjusting-fonts-for-dynamic-type/) and let us know what of these should be implemented.Side-note: It can already be used today, is the
textStyle
property in thefont
object is set toTi.UI.TEXT_STYLE_BODY
, e.g.:After changing the accessibility size in the settings, it will adopt it automatically when reopening the app. And again, make sure to check the [other constants](http://docs.appcelerator.com/platform/latest/#!/api/Font-property-textStyle) as well - they are meant to cover all kind of native layout sizes, e.g. headline, subtitle, different title sizes, captions and callouts.
For using custom fonts with
textStyles
the iOS 11+UIFontMetrics
API can be used. If you use Hyperloop, the following could be done today:This could eventually also be done in Titanium, but please note that it would still be iOS 11+ due to the Apple limitations in earlier versions. Road more about the API [here](https://useyourloaf.com/blog/using-a-custom-font-with-dynamic-type/). Once approved by product management, we can scope and implement the change.
PR - https://github.com/appcelerator/titanium_mobile/pull/11364 Test Case 1-
Test Case 2 - Use attached app.zip with new alloy app. Steps to test - 1. Launch the app. See the font type and text size. 2. Close app. 3. Open Settings->Accessibility->Display & Text Size-> Large Text. Increase text size from slider. 4. Open app. See the font type and text size. It should vary.
FR Passed. Waiting on Jenkins build.
merged to master for 9.0.0
Closing ticket, fix verified in SDK version
9.0.0.v20200103081513
. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11364