Repository navigation
fix(gesture): only start gestures on the primary mouse button - #31561
Open
Metehan-Bicer wants to merge 1 commit into
Open
Metehan-Bicer wants to merge 1 commit into
Metehan-Bicer wants to merge 1 commit into
Conversation
A right click started the drag gesture of segment, range, toggle and the other gesture-based components. On macOS the context menu swallows the mouseup, so the gesture stayed active and moving the pointer changed the value until the next left click. resolves ionic-team#29872
|
@Metehan-Bicer is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Issue number: resolves #29872
What is the current behavior?
The pointer-events gesture helper starts a gesture on
mousedownfor any mouse button. On macOS a right click opens the context menu, which swallows themouseup, so the gesture stays active: moving the pointer keeps dragging theion-segmentindicator, changes the value and firesionChangeuntil the next left click.ion-range,ion-toggleand the other drag-based components share the helper.What is the new behavior?
handleMouseDownincore/src/utils/gesture/pointer-events.tsreturns early for a non-primary button (ev.button > 0), so right and middle clicks no longer start a gesture. The tap-click utility already ignores right clicks the same way. Touch input is unchanged, and an event without abuttonvalue still starts the gesture as before.segment-events.e2e.ts: holding the right button on the selected segment button and moving to the last one leaves the value at1and emits noionChange. Playwright can't open the native context menu, so the test keeps the right button pressed while the pointer moves, which hits the same code path. It fails onmainin Chromium, Firefox and WebKit (Expected: "1" Received: "3") and passes with the change. The left-button drag is still covered by the existing test.I checked the other
createGestureusers (range, toggle, menu, item-sliding, reorder, refresher, modal sheet, toast, swipe back): none relies on a non-primary button.Does this introduce a breaking change?
Other information
segment-events.e2e.tspasses (27 tests), and so do the spec suite and the non-screenshot range and toggle e2e tests (range-events, custom, scroll, scroll-target, dual-knobs, toggle a11y). Ctrl+click on macOS also opens the context menu but reportsbutton === 0, so it isn't covered here.