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

Text Font Scaling should allow thresholds #15433

Closed
Jpoliachik opened this issue Aug 9, 2017 · 4 comments
Closed

Text Font Scaling should allow thresholds #15433

Jpoliachik opened this issue Aug 9, 2017 · 4 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Jpoliachik
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v: 0.42.3
  2. node -v: 8.2.1
  3. npm -v: 5.3.0
  4. yarn --version 0.19.1
  • Target Platform: iOS

  • Development Operating System: macOS

  • Build tools: Xcode

Steps to Reproduce

On iOS, set the Accessibility Text as large as possible.
(iOS Settings -> General -> Accessibility -> Larger Text -> Larger Accessibility Sizes -> Drag to Far Right)

(Android accessibility scaling works as expected, this is an iOS-only issue)

React Native scaled text becomes WAY larger than expected, to the point where the view is broken.

Expected Behavior

With the largest accessibility text setting possible, apps are expected to scale the text, but still be useable.
React Native views are effectively useless at this massive level of font scaling.

Font Scaling on <Text> is a boolean, but there should be a way to set thresholds or customize the level of scaling based on the accessibility setting.

Actual Behavior

See the current Instagram app's Push Notification Settings view (which uses React Native).
For a reproducible demo, navigate to the current Live Instagram app with the largest accessibility setting and you'll see this:

This view is essentially broken.
image

@Jpoliachik
Copy link
Author

RCTAccessiblityManager.m sets the font scaling multipliers. These values need to be customizable:

{
  if (_multipliers == nil) {
    _multipliers = @{UIContentSizeCategoryExtraSmall: @0.823,
                     UIContentSizeCategorySmall: @0.882,
                     UIContentSizeCategoryMedium: @0.941,
                     UIContentSizeCategoryLarge: @1.0,
                     UIContentSizeCategoryExtraLarge: @1.118,
                     UIContentSizeCategoryExtraExtraLarge: @1.235,
                     UIContentSizeCategoryExtraExtraExtraLarge: @1.353,
                     UIContentSizeCategoryAccessibilityMedium: @1.786,
                     UIContentSizeCategoryAccessibilityLarge: @2.143,
                     UIContentSizeCategoryAccessibilityExtraLarge: @2.643,
                     UIContentSizeCategoryAccessibilityExtraExtraLarge: @3.143,
                     UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: @3.571};
  }
  return _multipliers;
}

That way, we can set the ExtraLarge* values to stop at 2x, rather than scale to 3.57x - which is WAY too large for most applications.

What mechanism should we use to allow customizability here?

@Jpoliachik
Copy link
Author

I created a temporary workaround for myself by swizzling the multipliers getter. If anyone is interested, here's the code: https://gist.github.com/Jpoliachik/ed5cb38b480bc544427ce0db529786bf

@stale
Copy link

stale bot commented Oct 13, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 13, 2017
@stale stale bot closed this as completed Oct 20, 2017
@sahrens
Copy link
Contributor

sahrens commented Feb 15, 2018

Note you should also be able to tune these in JS with AccessibilityManager.setAccessibilityContentSizeMultipliers

@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants