Repository navigation
fix(dashboard): a touch tap no longer reveals hover content and loses its click - #17366
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Verify on a real iOS device that one tap on each control acts at once. The author did not run it on a device, and the jsdom tests only replay the event order. [UX-REVIEWED] a4822b5 Description read[DESCRIPTION-READ] da81338d25f099bc94bd5ffb30c1dbf715211c46e33e09b8fe369327b4027087 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 |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The touch-replay rule now exists twice ( Not justified as shipped
What this change shipsInventory (7 items) — 5 justifiedIntent: on iPhone, one tap on four hover-reveal controls should act on the first try. This is a FIX (Fixes #15341).
[FIRST-PRINCIPLES-REVIEWED] a4822b5 Description read[DESCRIPTION-READ] 4654749841b2904342383f468db0dc498f7b75c42d7b7ea0d37742f6f8b40962 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The fix's only claimed effect, restoring the first tap on iOS, was never confirmed on a device, and the jsdom tests can't show it. WatchNot verified on iOS: the description says "Not run on a real iPhone". The jsdom tests replay a hand-written event order, and nothing checks that WebKit sends [DESIGN-REVIEWED] a4822b5 Description read[DESCRIPTION-READ] f6817a39989c5ba805ef0d06657f439a9383459d0e17c8e7c36f120cdd630ecf 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
c65e3a4 to
b91738f
Compare
… its click On iOS a tap replays mouseenter before Safari decides to send the click, and content that appears from that replay (at once, or from a timer of 400ms or less) makes WebKit read the tap as a hover and drop the click. Four sites revealed from onMouseEnter with no pointer-type check: RefLink's hover card, useHoverIntent's trigger, MarkdownToc's flyout and the collapsed nav rail's useNavTip label. Add useTouchReplay, the rule useInstantTip already applies: record the pointer type from the anchor's own pointer events and skip the reveal for a touch tap's replay window. A mouse on a touch device still hovers, and keyboard focus after the window still opens. MarkdownToc records on the nav through React's synthesized pointer events, because the nav itself is pointer-events-none. useHoverIntent gates only the trigger's hover open; the surface's cancel-close and the ArrowDown opener are unchanged. FeedbackPill's openOnTap is left as is: it is a deliberate choice that needs a product decision. Fixes #15341
b91738f to
a4822b5
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
This is a small, well-scoped fix. It moves the TOUCH_REPLAY_WINDOW_MS rule that useInstantTip already ships into useTouchReplay and applies it to the four sites that reveal content. Mouse hover, keyboard focus and ArrowDown are left as they were. I checked that pointer type is read per event, not per device, so a mouse on a touch laptop still hovers. The tap tests replay the pointer events, then the mouse events, then the click, and the description says they fail with the gate disabled, which is the right proof. Two non-blocking follow-ups: useInstantTip still has its own copy of the touchUntilRef/notePointer logic, so one should call the other to keep a single definition. And one tap on each control in iOS Safari would confirm the event ordering jsdom can't model, especially for MarkdownToc, where the pointer events bubble up to a pointer-events-none nav. No security surface is touched, and CI is green.
Problem / Motivation
Goal: On iPhone, one tap on an issue-radar reference, a hover-intent trigger, a document-outline tick, or a collapsed nav-rail row acts on the first try.
On iOS a tap replays
mouseover/mouseenterbefore Safari decides whether to send the click. If a handler on that replayed event shows new content, either at once or from a single-shot timer of 400ms or less, WebKit treats the tap as a hover and drops the click. The user then has to tap twice. #14798 fixed this foruseInstantTipand the paste-token chip. Four more sites still reveal content fromonMouseEnterwith no pointer-type check:RefLink: the issue-radar hover card opens on a 320ms timer.useHoverIntenttriggerProps: opens on a 320ms timer. Consumers are inApp.tsx,ChatPage.tsxandmetricsReadout.tsx.MarkdownToc: the outline flyout expands synchronously over the clickable ticks.useNavTip: the collapsed nav-rail label mounts synchronously.Why it matters
Every touch user on iOS loses the first tap on these controls. That covers reference links in issue and PR bodies, the session flyout toggle, the focus-mode peeks, the metrics button, outline ticks in long documents, and nav-rail rows when the rail is collapsed on a tablet.
Not a goal
openOnTapusage warning. fix(website): keep touch taps from opening InstantTip hints #14798 kept it on purpose, and replacing it with visible text or a confirm step needs a product decision (see the issue thread).useInstantTiponto the new hook. It already has the gate, and moving it would be churn with no behaviour change.What changed (motivation → approach → change)
Symptom: a tap on these anchors does nothing the first time on iOS. Root cause: each site reveals content from React's
onMouseEnter, which also fires for a tap's compatibility replay, inside WebKit's content-change window.Approach: this applies the rule
useInstantTipalready ships (TOUCH_REPLAY_WINDOW_MS). The hook records the pointer type from the anchor's ownpointerenter/pointerdown/pointerup, and the reveal is skipped while a touch tap's replay window is open. The pointer type comes from the event, not from the device, so a mouse on a touch laptop or tablet still hovers. A keyboard focus that arrives after the window still opens where it does today. I picked the smallest change that matches the existing pattern: one shared hook instead of four copies of the same ref logic.website/src/hooks/useTouchReplay.ts: returnsfromTouch()andpointerProps, and reusesTOUCH_REPLAY_WINDOW_MSfromInstantTip.RefLink:scheduleOpen(shared byonMouseEnterandonFocus) returns early for a tap's replay, andpointerPropsgoes on the anchor.useHoverIntent:scheduleOpen('hover')returns early for a tap's replay, andtriggerPropscarriespointerProps. ArrowDown (scheduleOpen('keyboard')) and the surface'sonMouseEnter: cancelCloseare untouched, so a card that did open can still be reached.MarkdownToc:openreturns early for a tap's replay. The<nav>ispointer-events-none, so a native listener on it would never fire.pointerPropsuses React's synthesized pointer events instead, and those do reach the nav from the ticks.useNavTip:showTipreturns early for a tap's replay. The hook returnspointerProps, and both consumers (App.tsxNavItemandappRail.tsx) spread it on the row.Backwards compatibility
Compatible: mouse hover, keyboard focus and ArrowDown behave exactly as before. Only a touch tap's replayed enter (and the focus its mousedown gives, within the same window) stops revealing.
useHoverIntent'striggerPropsgains three pointer handlers, and no consumer sets its own pointer handlers on those triggers.Removes nothing: no API, key or behaviour that a mouse or keyboard user reaches is removed; the hook only adds a touch-replay check before each reveal.
Tests
website/src/test/touchTapReveal.test.tsx(new):useHoverIntent: a replayed touch tap runs the trigger's click and never opens the surface. A mouse pointer still opens afterHOVER_OPEN_MS, and ArrowDown still opens right after a tap.useNavTip: a tap runs the row's click and mounts no label. A mouse enter still mounts it, and keyboard focus after the replay window still mounts it.MarkdownToc: a tap on a tick runs its click (the tick lights) and the flyout stays collapsed. A mouse enter still expands it.website/src/test/IssueRadarRefSheet.test.tsx: a tap opens the reference and the hover card never mounts, including at the point where WebKit waits out the replay timer. A mouse pointer still opens the card after 320ms.mouseenter, thenclick. I checked that all four tap tests fail with the gate disabled (fromTouchforced tofalse) and pass with it on.useHoverIntent.test.ts,cursorAway.relay.test.tsandfocusChrome.fullscreenReserve.test.ts: 88 tests across the five files pass.eslintandtsc -p tsconfig.app.jsonare clean..github/coverage-baselines/frontend.txt: dropped theMarkdownToc.tsxentry, because the new tests lift it to 82.8%, above the 80% floor (Coverage Gate asked for the removal).Manual verification
Not run on a real iPhone. The jsdom tests replay the event order a tap produces. On-device confirmation would mean one tap on each of these controls in iOS Safari.
Screenshots / video
Why no screenshot: Nothing renders differently; the change only stops a touch tap's replayed mouseenter from opening content, which a still image cannot show.
Related Issues
Fixes #15341
Pattern harvest
Rule candidate: lint
Pattern: a React
onMouseEnterhandler that reveals content (state set or a timer of 400ms or less) without a touch-pointer gate costs the tap its click on iOS. A lint rule could flagonMouseEnteron an element that has anonClickor interactive children unless it goes throughuseTouchReplay/useInstantTip.Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.