Conversation
…8741) In order to make the long-press context menu usable on touch devices, this PR fixes a bug where the menu opened on iOS but closed the moment the user lifted their finger (#8740). Radix's `ContextMenu` Trigger has its own 700ms touch long-press detection that is independent of tldraw's `long_press` event. When that timer fires, the menu opens while the same touch is still down. The pointerup that follows is read by the dismissable layer as an outside interaction and dismisses the menu before the user can choose anything. The fix swallows outside-interaction dismissals during a 500ms grace window after the menu opens, but only on coarse pointers — desktop right-click is untouched. ### Change type - [x] `bugfix` ### Test plan 1. On iOS Safari (or a touch-emulated browser), long-press the canvas in the examples app or on tldraw.com. 2. Confirm the context menu opens and stays open after the finger is lifted. 3. Tap a menu item; confirm the action runs and the menu closes. 4. Tap somewhere outside the menu (a fresh touch) and confirm the menu dismisses. 5. On desktop, right-click the canvas; confirm the menu opens, an item can be selected, and an outside click dismisses it normally. - [ ] Unit tests - [ ] End to end tests ### Release notes - Fix the iOS context menu closing immediately after a long-press release. ### Code changes | Section | LOC change | | --------- | ---------- | | Core code | +20 / -2 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )