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: added accessibility value aliases #34535

Closed

Conversation

dakshbhardwaj
Copy link
Contributor

Summary

This adds aliasing for accessibility Value, it's used as requested on #34424.

Changelog

[General] [Added] - Add aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext as alias prop to TouchableOpacity, View, Pressable TouchableHighlight TouchableBounce TouchableWithoutFeedback TouchableOpacity components

Test Plan

  • Enable talkback.
  • Open the RNTester app and navigate to the Api's tab
  • Go to the fake Slider Example for Accessibility Value modes section

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Aug 30, 2022
@react-native-bot react-native-bot added the Type: Enhancement A new feature or enhancement of an existing feature. label Aug 30, 2022
@analysis-bot
Copy link

analysis-bot commented Aug 30, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,640,076 -1,366
android hermes armeabi-v7a 7,052,425 -1,309
android hermes x86 7,941,824 -1,341
android hermes x86_64 7,913,752 -1,473
android jsc arm64-v8a 9,514,674 -48
android jsc armeabi-v7a 8,290,285 -46
android jsc x86 9,454,000 -51
android jsc x86_64 10,045,066 -53

Base commit: 5e1c4d4
Branch: main

@analysis-bot
Copy link

analysis-bot commented Aug 30, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 5e1c4d4
Branch: main

@jacdebug
Copy link
Contributor

jacdebug commented Aug 30, 2022

Thanks for working on this, could you please have a look on failing test @dakshbhardwaj

@dakshbhardwaj
Copy link
Contributor Author

Thanks for working on this, could you please have a look on failing test @dakshbhardwaj

@jacdebug I have updated my PR

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@jacdebug jacdebug left a comment

Choose a reason for hiding this comment

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

Sorry for late review, please see inline comment for changes requested.

text:
props['aria-valuetext'] !== null
? props['aria-valuetext']
: props.accessibilityValue?.max,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
: props.accessibilityValue?.max,
: props.accessibilityValue?.text,

text:
this.props['aria-valuetext'] !== null
? this.props['aria-valuetext']
: this.props.accessibilityValue?.max,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
: this.props.accessibilityValue?.max,
: this.props.accessibilityValue?.text,

text:
this.props['aria-valuetext'] !== null
? this.props['aria-valuetext']
: this.props.accessibilityValue?.max,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
: this.props.accessibilityValue?.max,
: this.props.accessibilityValue?.text,

text:
this.props['aria-valuetext'] !== null
? this.props['aria-valuetext']
: this.props.accessibilityValue?.max,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
: this.props.accessibilityValue?.max,
: this.props.accessibilityValue?.text,

text:
this.props['aria-valuetext'] !== null
? this.props['aria-valuetext']
: this.props.accessibilityValue?.max,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
: this.props.accessibilityValue?.max,
: this.props.accessibilityValue?.text,

@dakshbhardwaj
Copy link
Contributor Author

Sorry for late review, please see inline comment for changes requested.

@jacdebug Thanks for the review, I have pushed down the review changes

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@jacdebug jacdebug left a comment

Choose a reason for hiding this comment

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

One more left

Libraries/Components/Pressable/Pressable.js Outdated Show resolved Hide resolved
Co-authored-by: jacdebug <jacob.deepak@yahoo.com>
@dakshbhardwaj
Copy link
Contributor Author

One more left

@jacdebug pushed the changes

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@jacdebug
Copy link
Contributor

jacdebug commented Sep 8, 2022

there are some new conflicts @dakshbhardwaj

@dakshbhardwaj
Copy link
Contributor Author

there are some new conflicts @dakshbhardwaj

@jacdebug I have resolved the conflicts

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@jacdebug jacdebug left a comment

Choose a reason for hiding this comment

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

Please see inline commend use nullish coalescing operator is correct and make code more readable.

Comment on lines 248 to 251
max:
props['aria-valuemax'] !== null
? props['aria-valuemax']
: props.accessibilityValue?.max,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
max:
props['aria-valuemax'] !== null
? props['aria-valuemax']
: props.accessibilityValue?.max,
max: props['aria-valuemax'] ?? props.accessibilityValue?.max,

This is more accurate and simple, please update the change for rest of properties on all changed files.

@dakshbhardwaj
Copy link
Contributor Author

Please see inline commend use nullish coalescing operator is correct and make code more readable.

@jacdebug I have made the changes

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @dakshbhardwaj in e8739e9.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 9, 2022
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
This adds aliasing for accessibility Value, it's used as requested on facebook#34424.

- [aria-valuemax](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) to equivalent [accessibilityValue.max](https://reactnative.dev/docs/accessibility#accessibilityvalue)
- [aria-valuemin](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) to equivalent [accessibilityValue.min](https://reactnative.dev/docs/accessibility#accessibilityvalue)
- [aria-valuenow](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) to equivalent [accessibilityValue.now](https://reactnative.dev/docs/accessibility#accessibilityvalue)
- [aria-valuetext](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext) to equivalent [accessibilityValue.text](https://reactnative.dev/docs/accessibility#accessibilityvalue)

## Changelog

[General] [Added] - Add `aria-valuemax`, `aria-valuemin`, `aria-valuenow`, `aria-valuetext` as alias prop to `TouchableOpacity`, `View`, `Pressable` `TouchableHighlight` `TouchableBounce` `TouchableWithoutFeedback` `TouchableOpacity` components

Pull Request resolved: facebook#34535

Test Plan:
- Enable `talkback`.
 - Open the RNTester app and navigate to the Api's tab
 - Go to the `fake Slider Example for Accessibility Value `modes section

<Image src="https://user-images.githubusercontent.com/22423684/187472543-05200d8d-2742-4096-a56c-41f81b440a97.png" height="600" width="300" />

Reviewed By: cipolleschi

Differential Revision: D39206362

Pulled By: jacdebug

fbshipit-source-id: e7ed263badac789d529dd21e961cda5302b031e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Needs TypeScript Update Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. Type: Enhancement A new feature or enhancement of an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants