Repository navigation
fix(ios): reliable touch selection, selection menu taps, and lossy text decoding - #3146
Open
deadlyjack wants to merge 8 commits into
Open
deadlyjack wants to merge 8 commits into
deadlyjack wants to merge 8 commits into
Conversation
…ture WebKit delivers pointerdown but never pointerup or pointercancel when a native gesture claims a touch, such as dragging a text selection handle or double-tapping a word, so the editor kept believing a finger was down and hid the selection menu until the next touch. WebTouchEnd now observes touches natively without preventing or delaying any gesture; when the last finger lifts, pages and their frames receive a pointercancel for the touch pointers still held, after a short settle window so a real pointerup that arrives late wins. The recognizer never fails itself, because a failed recognizer is not reset while WebKit's double-tap recognizer is pending, which made it miss the second tap. It is installed in the main and preview WebViews, and it tolerates a missed touch-end instead of silencing itself. Selection menu buttons now activate on the touch's touchend, with a 100 ms fallback, so removing the menu cannot drop touchend and let WebKit place the caret under the finger, and they accept WebKit's emulated mousedown when a tap never reports pointerup. The menu also restores the selection that WebKit's native text tap moves or clears behind a press, bounded to 1.5 s and dropped when the press is cancelled. Copying on iOS shows a confirmation toast, and the colour action only appears when the caret or selection holds a colour, using the menu's own editor state so split panes no longer disagree.
Contributor
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; the previous late-tap issue is fixed and no new blocking issues were found. SummaryThe PR repairs missing iOS touch releases and improves selection-menu taps. The latest change preserves selection protection when WebKit reports a cancelled tap through a late
Reviews (4) · Last reviewed commit: "fix: Late taps lose selection protection" · Reviewed by Greptile |
The guard that restores the selection after a menu press no longer outlives the press: any tap outside the menu and any key press in the editor clears it, so the following selection change belongs to the editor. A selection-changing menu action keeps its own selection, because the restore is skipped while an action runs. The docs now describe the guard's full lifetime, and tests cover a second press on the menu, an action that changes the selection, and the outside-tap and key-press cases.
Member
Author
added 3 commits
December 2, 2026 16:44
Cancel stale touch pointers after native gestures, activate menu buttons on touch end with WebKit fallbacks, and restore selections cleared by iOS native text taps. Gate the tap guard to iOS and keep touched buttons activatable after WebKit cancels the pointer. Decode malformed text like Android instead of failing and cover the behaviour with tests. Bump the build number to 1027.
Member
Author
Member
Author
Resolve conflicts with #3149: the menu now takes the tapped pane's view, gates "insert color" on getColorRange(view.state), and passes the view to insert-color, which reads the range from that view's state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first suite timed out after ~10s while a cold hosted simulator took about a minute to finish the initial page load. Wait up to 90s instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Makes text selection and the touch selection menu reliable on iOS, and fixes a few iOS issues along the way.
Touch pointers WebKit leaves down
WebKit sends
pointerdown, then never sendspointeruporpointercancel, when a native gesture takes over a touch (dragging a selection handle, double-tapping a word). The editor kept thinking a finger was down and hid the selection menu until the next touch.WebTouchEndwatches touches natively without blocking or delaying any gesture. When the last finger lifts, it sendspointercancelto the page and its frames for every touch pointer still held. It waits a short moment first, so a realpointerupthat arrives late still wins.Selection menu
touchend, with a 100 ms fallback. Removing the menu can no longer swallow thetouchendand let WebKit move the caret under the finger. Buttons also accept WebKit's emulatedmousedownwhen a tap never reportspointerup.Text decoding
FileContents.decodenow handles malformed bytes the way Android does: they become U+FFFD instead of the whole decode failing. A UTF-8 BOM is stripped.Tests and CI
getColorRange. Native tests coverWebTouchEndandFileContents.PreviewTransferTestsretries the initial preview load once.BridgeTestCasewaits up to 90 s for the app WebView on a cold start.docs/ios-port.mddocuments the touch-end and tap-guard behaviour.🤖 Generated with Claude Code