fix: conditionally apply onPress for Accessibility mode for Android TouchableOpacity cp-7.57.0#21146
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…to fix/touchable-gesture-android-3
|
Testing the latest QA build of this fix:
buy-deposit.-.option.3.fix.mp4Option.3.fix.-.Accounts.list.mp4
|
|
Testing on the latest QA build from here :
buy-deposit.fixed.mp4withdraw.fix.mp4 |
|
Seeing the same as @Unik0rnMaggie - Buy-Deposit-Withdraw big fixed.
Screen_Recording_20251015_122201_MetaMask.QA.mp4 |
…to fix/touchable-gesture-android-3
41ca267 to
f04dfc7
Compare
|
There was a problem hiding this comment.
Pull Request Overview
Refactors press handling to remove timestamp-based coordination and introduce accessibility-aware gesture vs onPress usage, with numerous snapshot updates reflecting changed props. Key changes: removal of useCoordinatedPress hook in Perps components, addition of AccessibilityInfo-driven conditional onPress logic in ButtonBase/ListItemSelect/ListItemMultiSelect, and updated test-mode fallbacks. Snapshots updated to reflect conditional omission or mocking of onPress.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| PressablePerpsComponent/PressablePerpsComponent.tsx | Removes deprecated coordinated press hook, simplifying export. |
| PerpsCard/PerpsCard.tsx | Drops coordinatedPress usage; directly invokes handler. |
| PerpsTabView/PerpsTabView.tsx | Removes coordinatedPress; direct press invocation. |
| ListItemSelect/ListItemSelect.tsx | Adds accessibility state tracking and gesture/onPress bifurcation; removes coordination logic. |
| ListItemMultiSelect/ListItemMultiSelect.tsx | Similar accessibility handling plus iOS checkbox timing coordination refactor. |
| ButtonBase/ButtonBase.tsx | Implements accessibility-aware gesture handling and removes coordination logic. |
| Various *.snap files | Snapshot updates reflecting removed or mocked onPress handlers under new logic. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
georgewrmarshall
left a comment
There was a problem hiding this comment.
Great work addressing the button responsiveness issues! Approving to unblock ✅
There seems to be significant DRY violations that could be addressed in a follow up. The custom TouchableOpacity wrapper is duplicated many times. Could we create a hook centralize the accessibility and gesture logic?
Excellent problem solving! Technical approach is strong and just needs some architectural cleanup. 👍
gambinish
left a comment
There was a problem hiding this comment.
Tests well on Android. Opened a few positions on Perps tab and was able to navigate them. Changing tabs worked well.
Yes. The patch would reduce the duplicated problem |



Description
This PR fixes critical button responsiveness issues in ScrollView and BottomSheet contexts by refactoring gesture handling and removing deprecated press coordination logic across the component library.
Problem:
useCoordinatedPresshook was causing double-firing issues and race conditions with accessibility featuresSolution:
requireExternalGestureToFail()with tight constraints (300ms max duration, 20px max delta) to allow buttons to work alongside BottomSheet gesturesuseCoordinatedPresshook and related timestamp-based coordination logicRNTouchableOpacityin test environmentsChangelog
CHANGELOG entry: Fixed button responsiveness issues in ScrollView and BottomSheet contexts
Related issues
Fixes: #18704
Manual testing steps
Screenshots/Recordings
Before
After
Technical Changes
Core Components Updated:
ButtonBase.tsx- Added gesture handler withrequireExternalGestureToFail()and tight constraints, accessibility state tracking to prevent double-firingListItemSelect.tsx- Same gesture priority fix and accessibility handlingListItemMultiSelect.tsx- Updated gesture handling while preserving iOS checkbox coordinationPressablePerpsComponent.tsx- RemoveduseCoordinatedPresshook (already compatible)Perps Components Updated:
PerpsTabView.tsx- RemoveduseCoordinatedPressusage, directonPresscallsPerpsCard.tsx- RemoveduseCoordinatedPressusage, simplified press handlingKey Technical Improvements:
requireExternalGestureToFail()allows BottomSheet pan gestures to take priority when needed, while still detecting taps within tight constraintsnullinitial state forisAccessibilityEnabledto handle async updates safely; exclusive handling prevents double-firingImplementation Details:
isAccessibilityEnabled === false(known OFF state)onPressonly fires whenisAccessibilityEnabled !== false(ON or UNKNOWN state)onEndlifecycle used (notonStart) to ensure complete gesture detectionPre-merge author checklist
Pre-merge reviewer checklist
Note
Makes Android touchables accessibility-aware with gesture priority management to avoid ScrollView and BottomSheet conflicts, removes press coordination logic, and simplifies Perps press handling with test-safe fallbacks.
Buttons/Button/foundation/ButtonBase: AddsAccessibilityInfo-aware tap handling (gesture only when screen reader is off),requireExternalGestureToFail()with tight constraints (300ms, 20px delta), test-mode fallback toRNTouchableOpacity; implements exclusiveonPresshandling to prevent double-firing.ListItemSelect/ListItemMultiSelect: Mirrors accessibility-aware gesture handling with priority management; refactors iOS checkbox coordination; provides test-mode fallback and conditionalonPresswiring.PressablePerpsComponent: Keeps platform-specific touchable; removesuseCoordinatedPresshook.PerpsTabView/PerpsCard: DropsuseCoordinatedPressusage; invoke handlers directly.onPressand test-mode behavior ([MockFunction]), across various UI snapshots.Written by Cursor Bugbot. This will update automatically on new commits. Configure here.