Skip to content

Fix whilePressing interaction getting stuck on multi-touch drag#2410

Open
ghost wants to merge 2 commits intomainfrom
wb/priyanksingh/issue2-multi-touch-while-pressing
Open

Fix whilePressing interaction getting stuck on multi-touch drag#2410
ghost wants to merge 2 commits intomainfrom
wb/priyanksingh/issue2-multi-touch-while-pressing

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Apr 9, 2026

Fixes a bug where a button with a whilePressing prototyping interaction remains stuck in its pressed variant if multiple fingers are held down and dragged before being released.

The issue stems from how Jetpack Compose handles multi-pointer gesture cancellations in the tryAwaitRelease() coroutine. By encapsulating the cleanup steps—specifically emitting the PressInteraction.Cancel or PressInteraction.Release and undoing the 'on press' reactions—within a finally block inside the onPress handler of detectTapGestures, we guarantee that regardless of how the touch gesture terminates (e.g., standard release or pointer cancellation from dragging multiple fingers), the UI correctly resets.

This commit addresses a bug where a button with a whilePressing prototyping interaction remains stuck in its pressed variant if multiple fingers are held down and dragged before being released.

The issue stems from how Jetpack Compose handles multi-pointer gesture cancellations in the tryAwaitRelease() coroutine. By encapsulating the cleanup steps—specifically emitting the PressInteraction.Cancel or PressInteraction.Release and undoing the 'on press' reactions—within a finally block inside the onPress handler of detectTapGestures, we guarantee that regardless of how the touch gesture terminates (e.g., standard release or pointer cancellation from dragging multiple fingers), the UI correctly resets.
@ghost ghost requested a review from dipenpradhan April 9, 2026 04:47
@ghost ghost enabled auto-merge April 9, 2026 04:48
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.05%. Comparing base (af5409b) to head (e2cf173).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2410   +/-   ##
=========================================
  Coverage     44.05%   44.05%           
  Complexity       19       19           
=========================================
  Files            39       39           
  Lines          4444     4444           
  Branches         51       51           
=========================================
  Hits           1958     1958           
  Misses         2472     2472           
  Partials         14       14           
Flag Coverage Δ
kotlin 72.17% <ø> (ø)
rust 41.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Snapshot diff report vs base branch: main
Last updated: Thu Apr 9 16:02:32 PDT 2026, Sha: e2cf173
No differences detected

@anshu10sep anshu10sep disabled auto-merge April 9, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants