Repository navigation
fix(website): keep touch taps from opening InstantTip hints - #14798
Conversation
|
Intent: A single touch tap on any button that uses the shared InstantTip hook (follow-up chips, inline-code copy chips, the feedback pill, the image resize badge) and on the composer's paste-token chip runs its action on the first tap, because the tap no longer opens a hover tooltip or preview that iOS Safari treats as a hover. |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the pending on-device iPhone check (#53's three taps): iOS click suppression runs in no CI browser, so the WebKit-source premises are untested on hardware. What this change shipsInventory (8 items) — 8 justifiedIntent: on a phone, one tap on a tooltip-carrying button runs its action — a FIX (provenance: touch-tap tests added here fail with the production hunks reverted; mechanism read from WebKit's ContentChangeObserver.cpp at a pinned commit).
Counts run: [FIRST-PRINCIPLES-REVIEWED] 9324daa Description read[DESCRIPTION-READ] 9bb532ed395cbdd5c9154c56f8c700709d78fe8d68261dac9a47ea1767a40238 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The fix's effectiveness is untested on the only platform that shows the bug — the iPhone check the PR names is still pending. WatchBoth load-bearing premises (tooltip mount during replay costs the click; pointer events precede the replayed mouse events) are read from WebKit source, not observed on a device; jsdom replays the order the author assumed. If either premise is off on real iOS, phone users keep double-tapping while every Android user has already paid the cost of losing tap-to-read tooltips ("On Android, a tap therefore no longer opens a tooltip either"). [DESIGN-REVIEWED] 9324daa Description read[DESCRIPTION-READ] 2cf4b45c8269d2d6ab6adc19357ef7370b50fe9296cc5c2dc852f9622b8ec9e6 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Fable 5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Verify the pending on-device iPhone check: one tap on a follow-up chip, a copy chip, and the "Resized" badge behaves as the description promises. [UX-REVIEWED] 9324daa Description read[DESCRIPTION-READ] d3e098f306b03e07313f4eda13938a22866f958b46bfc48a8cd20f2626166d16 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
717e852 to
63b7a35
Compare
|
self-added: yes
|
|
|
self-added: yes
|
|
63b7a35 to
6a2f334
Compare
|
|
6a2f334 to
60ba6ea
Compare
|
Rebased onto current main with no code change; new head The red Backend Tests (3.12, 1) shard on |
60ba6ea to
8a498c9
Compare
|
Same tree as Backend Tests (3.12, 1) failed again with the same three |
1acce2d to
af3988b
Compare
|
Re-synced onto main with no code change; new head |
|
Frontend Tests (4) on |
|
|
|
af3988b to
1f4ddc9
Compare
|
Re-synced onto main with no code change. New head |
|
|
On iOS Safari a tap replays mouseover/mouseenter before the click, and a hint mounted in that window counts as a hover content change, so Safari drops the click and the chip needs a second tap. useInstantTip now reads the tap's own pointer events and ignores the replayed mouseenter and focus for a short window; a mouse (pointerType mouse) still hovers and a held outcome still opens. PasteTokenNode opens its hover preview from a non-touch pointerenter instead of mouseenter, for the same reason.
1f4ddc9 to
9324daa
Compare
|
Design Review on 9324daa returned CONCERNS (advisory) with one Watch item, the on-device iPhone check. Disposition: needs-a-decision, unchanged from earlier heads. This head is a no-code-change rebase, so the WebKit-source evidence in the description still applies. The Watch item clears when the three first-tap checks (follow-up chip, inline-code copy chip, Resized badge) are run on an iPhone and posted here. |
bolichen97
left a comment
There was a problem hiding this comment.
Approved: PR Readiness green on this head, merges cleanly into current main, no outstanding blocking review.
Problem / Motivation
Goal: On a phone, one tap on a tooltip-carrying button runs its action.
On iPhone the first tap on a follow-up option chip, an inline-code copy chip, the feedback pill's "Request a feature" button or the image "Resized" badge often does nothing, and the second tap works. All four use the shared
useInstantTiphook. The paste-token chip in the composer has the same problem with its preview.Why it matters
Every phone user hits it on the controls they use most in a chat: picking a suggested reply and copying an inline value. A tap that silently fails reads as a broken button.
Not a goal
hover:variant. Each has its own PR.onMouseEnterwith no pointer-type check, and so can cost an iOS tap's click the same way, are left unfixed here:apps/issue-radar/components/RefLink.tsx(320ms hover card),hooks/useHoverIntent.ts(320ms open),components/MarkdownToc.tsx(synchronous expand) and the collapsed nav rail'suseNavTipinApp.tsx(synchronous label). They are tracked in iOS: three more onMouseEnter reveals cost the tap's click #15341, which also tracks replacing the feedback pill'sopenOnTapwith visible warning text on touch.What changed (motivation → approach → change)
A tap on a tooltip button no longer opens its tooltip, so on iPhone the first tap runs the button's action. Mouse hover and keyboard focus still show the tooltip.
For a tap, iOS Safari replays
mouseover/mouseenterbefore it decides to send the click. If content appears during that replay, Safari treats the tap as a hover and drops the click.useInstantTipinwebsite/src/components/InstantTip.tsxopened its tooltip fromonMouseEnteron a 100ms timer with no pointer check, so the tooltip was that content.The hook now listens to the anchor's own
pointerenter,pointerdownandpointerup. A touch pointer marks the nextTOUCH_REPLAY_WINDOW_MS(1s) as a tap replay, and amouseenterorfocusinside that window opens nothing. Any other pointer type clears the mark at once. The gate reads the event rather than the device, so a mouse on a touch laptop or tablet still hovers. Keyboard focus outside the window still shows the tip immediately. A held outcome such as the copy chip's "Copied!" still opens at the tapped anchor, becausefocusrecords the anchor before it returns.The resize badge in
website/src/components/chat-input/FilePreviewStrip.tsxhas no click action, so a tap there has no click to lose and its bubble is the only way a phone reads the sizes. It passes a newopenOnTapoption, which keeps the old tap-opens behaviour. The feedback pill's "Request a feature" button inwebsite/src/components/FeedbackPill.tsxpasses it too, because its bubble is the only place that says the click starts an agent turn that spends monthly usage (#13342). A phone user still sees that warning on the first tap, and on iOS that button may still need a second tap to act.website/src/components/PasteTokenNode.tsxopens its hover preview fromonPointerEnterwhen the pointer is not a touch, in place ofonMouseEnter. A tap's replayedmouseenterno longer opens it, and a mouse or pen on a touch device still previews on hover.onFocusstill previews, and the tap toggles the preview throughonClickas before. The chip doesn't need the hook's timed window: it opens from the pointer event itself, which carriespointerType, and never listens to the replayedmouseenter.McpInfoButtonalso opens a popover fromonMouseEnter, but no page renders it today, so it is left alone.Backwards compatibility
Compatible: mouse and keyboard paths are unchanged. Only mouse events that follow a touch pointer on the same anchor are ignored.
The touch gate applies on every touch browser, not only iOS, because the code has no reliable way to tell iOS WebKit apart and Android's tap was never broken. On Android, a tap therefore no longer opens a tooltip either, so a clamped follow-up chip label has no tap-to-read path there, just as on iPhone. The feedback pill's usage warning keeps its tap-open on every platform. On Android the warning appears as the tap starts the agent turn, which is what happened before this PR.
Tests
website/src/test/InstantTip.test.tsx: a full tap sequence runs the anchor's click and mounts no tooltip; apointerType: 'mouse'enter still opens after the delay; a mouse right after a tap hovers normally; keyboard focus after the window shows at once; a held outcome after a tap still opens.website/src/test/ChatInput.resizeBadge.test.tsxandInstantTip.test.tsx: withopenOnTap, a touch tap still opens the bubble.website/src/test/FeedbackPill.test.tsx: a touch tap on "Request a feature" shows the usage warning and still calls the action once. It fails withopenOnTapremoved.website/src/test/FollowUpBar.test.tsx: a touch tap on a chip callsonSelectonce and mounts no tooltip.website/src/test/LexicalComposerInput.test.tsx: a touchpointerenterplus replayedmouseenterdoes not open the paste preview, a tap toggles it, a mousepointerenterpreviews, and keyboard focus still previews.With the production hunks reverted, the three touch-tap tests fail.
Manual verification
Not yet run on an iPhone. iOS WebKit's click suppression does not run in Chromium, jsdom or Linux WebKit, so CI cannot exercise it. The on-device check, pending from the maintainer who has the device: tap a follow-up option chip once, tap an inline-code copy chip once, and tap the "Resized" badge on a downscaled image attachment once. The chip and the copy chip should each act on the first tap, and the badge should open its size bubble.
The two premises the fix rests on are read from WebKit's source,
Source/WebCore/page/cocoa/ContentChangeObserver.cppat 49480340a1, rather than from the order the tests replay:mouseMoved(isBetweenTouchEndAndMouseMoved), throughmouseMoveddispatch, and then for a short fixed window.didInstallDOMTimerfollows any single-shot timer of 400ms or less (maximumDelayForTimers) installed in that span, and an element that becomes visible when such a timer fires counts as a content change, so no click is sent. The oldonMouseEnterran insidemouseMoveddispatch and installed a 100ms single-shot timer, so the tooltip mount was an observed change. With this PR the replayedmouseenterreturns before it installs any timer.focuscomes from the syntheticmousedown, which WebKit sends only after it has decided to click, so the focus path could not cost the click. It is gated anyway so a tap does not leave a tooltip open with no leave event to close it.pointerdown/pointerupfrom the touch events themselves (PointerCaptureController::dispatchEventForTouchAtIndex, called from touch dispatch inEventHandler), and the synthetic mouse events start only atmouseMoved, after touchend. SonotePointerhas set the touch window beforemouseenterruns, which is the order thetap()helper inInstantTip.test.tsxreplays.Screenshots / video
Why no screenshot: the change removes a tooltip from the touch tap path; mouse and keyboard rendering is pixel-identical, and the touch difference is an event order that desktop capture cannot show.
Related Issues
Fixes #14797
Pattern harvest
Rule candidate: review-prompt
Pattern: content revealed from
onMouseEnter/mouseover(a timer-mounted tooltip, a popover, a preview) with no touch or pointer-type check costs iOS users the tap's click.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)