compose/ui/web: fix incorrect interpretation of ontouchend events#2490
Merged
eymar merged 4 commits intoJetBrains:jb-mainfrom Oct 24, 2025
Merged
Conversation
eymar
reviewed
Oct 16, 2025
Member
There was a problem hiding this comment.
Would you like to add a demo that you have created in the bug report? https://youtrack.jetbrains.com/issue/CMP-9030/wasm-canvas-incorrect-handling-of-multi-touch-input
It can be added here
compose/ui/ui/src/webCommonW3C/kotlin/androidx/compose/ui/window/ComposeWindow.w3c.kt
Outdated
Show resolved
Hide resolved
Author
|
Thank you for your review. I have applied your suggestion.
I'd like to keep the changeset small if that's fine for you ! I don't think the demo is needed in this case |
Member
|
Thank you for your contribution! LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In ComposeWindow.w3c.kt, the touch handler does not correctly handle the
touchendevent. Indeed the logic selecting betweentargetTouchesandchangedTouchesis flawed. Fortouchendboth should be taken into account, alsochangedTouchescontains the un-pressed pointer andtargetTouchescontains the rest of the remaining pressed pointers.The fix consists in removing the logic that compares the size of both
targetTouchesandchangedTouchesto pick the largest one.Instead, it checks the pointer event type to determine whether only
targetTouchesor bothtargetTouchesandchangedTouchesare needed while correctly accounting which touches are pressed depending on the source.Fixes: https://youtrack.jetbrains.com/issue/CMP-9030/wasm-canvas-incorrect-handling-of-multi-touch-input
Testing
I have added a failing test in
GestureTest.ktwhich is subsequently fixed by the implementation commit. The test consists in using three touches that are progressively pressed (1, 2, 3) and unpressed (3, 2, 1), logging and comparing the behavior of the pointerInput modifier with the expected events.Release Notes
Fixes - Web
ontouchendevents.