Skip to content

iOS: accessibilityValue percentage is wrong when min is not 0 #60015

Open

Description

@faciledictu

Description

On iOS, a view with accessibilityValue={{ min, max, now }} and no text gets a percentage as its value, computed as now / (max - min) (RCTViewComponentView.mm#L577-L578). min is not subtracted from now, and an empty range is not skipped:

  • { min: 10, max: 20, now: 15 } is read as "150%".
  • { min: 10, max: 20, now: 10 } is read as "100%".
  • { min: 5, max: 5, now: 5 } is read as "+∞".

aria-valuemin, aria-valuemax and aria-valuenow give the same values. Android gives TalkBack the range only when max > min and now is inside it. I'll send a fix.

Steps to reproduce

  1. Run the reproducer from ReproducerApp: yarn install, pod install in ios, then yarn ios.
  2. Open Accessibility Inspector and read the Value field of each element.

Expected: V2 "50%", V3 "0%", no value for V5.

Actual: V2 "150%", V3 "100%", V5 "+∞".

React Native Version

0.88.0

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

Same as in #59377.

Stacktrace or Logs

No crash or warning.

MANDATORY Reproducer

https://github.com/faciledictu/rn-a11y-value-percentage-repro

Screenshots and Videos

The reproducer's README has the value of each element.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions