-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Accessible Pressable] Create GenericPressable, PressableWithFeedback, PressableWithoutFeedback #17404
Conversation
6e88681
to
892dee8
Compare
if (!ref) { | ||
return; | ||
} | ||
AccessibilityInfo.sendAccssibilityEvent(ref, 'focus'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, given the response in that issue, let's not block on this.
|
||
return ( | ||
<Pressable | ||
hitSlop={shouldUseAutoHitSlop && hitslop} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F.e. link inside the text block. Applying hitslop could break the layout consistency in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android