Skip to content

fix: double press interaction on android cp-7.54.0#18729

Merged
sethkfman merged 14 commits into
mainfrom
fix/android-buttons
Aug 28, 2025
Merged

fix: double press interaction on android cp-7.54.0#18729
sethkfman merged 14 commits into
mainfrom
fix/android-buttons

Conversation

@brianacnguyen

Copy link
Copy Markdown
Contributor

Description

  • This PR removes the double onPress interaction on Android (Tap + onPress both being triggered)

Changelog

CHANGELOG entry:

Related issues

Fixes: #18704

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@brianacnguyen brianacnguyen requested a review from a team as a code owner August 25, 2025 15:31
@brianacnguyen brianacnguyen self-assigned this Aug 25, 2025
@github-actions

Copy link
Copy Markdown
Contributor

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.

@brianacnguyen brianacnguyen added team-design-system All issues relating to design system in Mobile No QA Needed Apply this label when your PR does not need any QA effort. Run Smoke E2E labels Aug 25, 2025
@github-actions

github-actions Bot commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 4dabe00
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/18465913-758e-404a-a583-5bb351578117

Note

  • You can rerun any failed steps by opening the Bitrise build, tapping Rebuild on the upper right then Rebuild unsuccessful Workflows
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

cursor[bot]

This comment was marked as outdated.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.67%. Comparing base (fe458f7) to head (4dabe00).
⚠️ Report is 90 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18729      +/-   ##
==========================================
+ Coverage   75.51%   75.67%   +0.15%     
==========================================
  Files        3092     3111      +19     
  Lines       71646    71951     +305     
  Branches    12413    12471      +58     
==========================================
+ Hits        54106    54446     +340     
+ Misses      14093    14056      -37     
- Partials     3447     3449       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@brianacnguyen brianacnguyen changed the title fix: removed double press interaction on android fix: double press interaction on android Aug 25, 2025
@github-actions github-actions Bot added size-M and removed size-S labels Aug 25, 2025
@github-actions

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: e54e220
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a0eea326-96ab-4a25-b5e0-9c7273b4c4e4

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

cursor[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 0a5c716
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/9d41a087-7521-4e96-a214-3570f55730ba

Note

  • You can rerun any failed steps by opening the Bitrise build, tapping Rebuild on the upper right then Rebuild unsuccessful Workflows
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@brianacnguyen brianacnguyen added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Aug 25, 2025
@sethkfman sethkfman linked an issue Aug 25, 2025 that may be closed by this pull request
cursor[bot]

This comment was marked as outdated.

@himanshuchawla009 himanshuchawla009 added the release-blocker This bug is blocking the next release label Aug 27, 2025
const conditionalOnPress = isDisabled
? undefined
: (_pressEvent?: GestureResponderEvent) => {
const now = Date.now();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wondering instead of date, we could use a mutex logic here, since we want to prevent double tap, if I'm thinking correctly mutex logic would prevent that, instead of relying on timings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nevermind that would be for async operations

Comment on lines +40 to +42
.shouldCancelWhenOutside(false)
.maxDeltaX(20) // Allow some movement while tapping
.maxDeltaY(20)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would this be the solution for the press on scroll view right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes

@brianacnguyen brianacnguyen changed the title fix: double press interaction on android fix: double press interaction on android cp-7.54.0 Aug 27, 2025
@github-actions

github-actions Bot commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 36edb85
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/8bc0fbf8-5bc0-4a62-8ca9-304c8ea3f35d

Note

  • You can rerun any failed steps by opening the Bitrise build, tapping Rebuild on the upper right then Rebuild unsuccessful Workflows
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 59a9aa3
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/f0524eb8-1eff-41c3-9bb3-e5303d83c73f

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
34.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a fix for double press interactions on Android devices. The issue was that both the gesture handler and accessibility onPress were being triggered simultaneously, causing duplicate function calls.

  • Adds coordination logic using timestamps to prevent double firing of onPress events within a 100ms window
  • Wraps TouchableOpacity components with custom gesture detection for Android while preserving accessibility
  • Implements platform-specific handling where Android uses gesture detection and iOS maintains standard TouchableOpacity behavior

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ListItemSelect.tsx Adds coordination system with timestamp-based deduplication and custom TouchableOpacity wrapper
ListItemMultiSelect.tsx Implements double-press prevention with platform-specific checkbox interaction handling
ButtonBase.tsx Adds gesture detection wrapper and coordination logic for button components
Test files Updates snapshots and test descriptions to reflect coordination logic changes
Snapshot files Updates to reflect new onPress function references and gesture wrapper structure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}

// Set timestamp BEFORE calling parent function (timestamp-first pattern)
lastCheckboxGestureTime.current = Date.now();

Copilot AI Aug 28, 2025

Copy link

Choose a reason for hiding this comment

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

The variable name lastCheckboxGestureTime is misleading because it's used for both checkbox gestures and main component coordination. Consider renaming to lastPressTime for consistency with other components like ListItemSelect and ButtonBase.

Copilot uses AI. Check for mistakes.
Comment on lines +130 to +132
const timeSinceLastGesture = now - lastCheckboxGestureTime.current;

if (onPress && timeSinceLastGesture > COORDINATION_WINDOW) {

Copilot AI Aug 28, 2025

Copy link

Choose a reason for hiding this comment

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

Variable name timeSinceLastGesture is inconsistent with other components that use timeSinceLastPress. This inconsistency makes the codebase harder to maintain.

Suggested change
const timeSinceLastGesture = now - lastCheckboxGestureTime.current;
if (onPress && timeSinceLastGesture > COORDINATION_WINDOW) {
const timeSinceLastPress = now - lastCheckboxGestureTime.current;
if (onPress && timeSinceLastPress > COORDINATION_WINDOW) {

Copilot uses AI. Check for mistakes.

@georgewrmarshall georgewrmarshall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work tackling this! Approving the design system changes to unblock release. I’ll defer to @MetaMask/mobile-platform engineers on the React Native and iOS/Android details of this fix. There also seem to be some Cursor/Copilot comments that could be addressed

@sethkfman sethkfman added this pull request to the merge queue Aug 28, 2025
Merged via the queue into main with commit 045377b Aug 28, 2025
73 of 79 checks passed
@sethkfman sethkfman deleted the fix/android-buttons branch August 28, 2025 18:44
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 28, 2025
@metamaskbot metamaskbot added the release-7.55.0 Issue or pull request that will be included in release 7.55.0 label Aug 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.55.0 Issue or pull request that will be included in release 7.55.0 release-blocker This bug is blocking the next release size-M skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-design-system All issues relating to design system in Mobile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: OnPress is called twice in ButtonBase [Bug]: Button not firing onPress consistently on Android

9 participants