[Accessible Pressable] Create GenericPressable, PressableWithFeedback, PressableWithoutFeedback#17404
Conversation
6e88681 to
892dee8
Compare
There was a problem hiding this comment.
AFAICT this API isn't documented. Why do we need to use this instead of ref.current.focus on native?
There was a problem hiding this comment.
When screen reader is active ref.current.focus on native won't shift screen reader (f.e. VoiceOver on iOS) focus.
You're right I can't find it too, but as I was doing the design doc I've only found two approaches:
- AccessibilityInfo.sendAccessibilityEvent: currently implemented here, but not documented
- AccessibilityInfo.setAccessibilityFocus: documented but needs reactTag of the next focused component. Obtaining the reactTag is connected with using
findNodeHandle– which is going to be (or is) deprecated, you sent me a video from conference which mentions it while I was writing the design doc.
I'll do more research about it.
There was a problem hiding this comment.
Maybe we can create an issue in the react-native repo to ask why AccessibilityInfo.sendAccessibilityEvent is not documented and what the alternative for AccessibilityInfo.setAccessibilityFocus is in a post-findNodeHandle world
There was a problem hiding this comment.
There was a problem hiding this comment.
Ok, given the response in that issue, let's not block on this.
There was a problem hiding this comment.
Do you know if there's any time we would use shuoldUseAutoHitSlop={false}? I'm wondering if we can just simplify and always use autoHitSlop
There was a problem hiding this comment.
F.e. link inside the text block. Applying hitslop could break the layout consistency in it.
There was a problem hiding this comment.
Ok ... my understanding with hitSlop is that it would never affect layout and never extend beyond the bounds of the parent. I'll play with this some more and see if I can break the layout of a text block with hitSlop
There was a problem hiding this comment.
there is another point, maybe more meaningful. The minimal size of the accessible component is stated inside https://www.w3.org/WAI/WCAG21/Understanding/target-size.html says that it can be omited for the inline
There was a problem hiding this comment.
also two inline links which are close to each other would have overlapping touchableAreas after applying hitslops
…andlers in useCallback
…ble component prohibited cursor change
amyevans
left a comment
There was a problem hiding this comment.
Sorry, few more quick comments 😅
src/components/Pressable/GenericPressable/BaseGenericPressable.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Amy Evans <amy@expensify.com>
Co-authored-by: Amy Evans <amy@expensify.com>
Reviewer Checklist
Screenshots/VideosNo screenshots for now, but we'll do more manual testing as we implement these components throughout the app. WebMobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
|
Looks like @dangrous is partially OOO the next couple days, and his comments have been addressed here, so as this is blocking a few other things I'm going to go ahead and merge this so we can keep this project moving forward. @dangrous feel free to leave any remaining comments and I'm sure @robertKozik would be happy to address them in a follow-up if needed. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.3.8-0 🚀
|
|
This PR caused another regression of #17073. It was fixed in #17908 but happening again after this PR. |
|
🚀 Deployed to production by https://github.com/marcaaron in version: 1.3.8-8 🚀
|
|
Just some feedback for the future: let's make sure we have test/QA steps in the PR. Even if it's just a list of pages to go and test the buttons to make sure they are working as expected. |
| const PressableWithFeedbackPropTypes = { | ||
| ..._.omit(GenericPressablePropTypes.pressablePropTypes, omittedProps), | ||
| pressDimmingValue: propTypes.number, | ||
| hoverDimmingValue: propTypes.number, | ||
| }; |
There was a problem hiding this comment.
Why there are no comments for propTypes?
Details
Implementation of GenericPressable, PressableWithFeedback, PressableWithoutFeedback components
Fixed Issues
$ #16988
PROPOSAL: GH_LINK_ISSUE(COMMENT)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android