Repository navigation
fix(ui): GitHub link hovercard closes before the pointer can reach it - #124274
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 7:57 PM ET / 23:57 UTC. ClawSweeper reviewWhat this changesRepairs Control UI GitHub preview-card hover traversal, makes the preview keyboard-operable as a dialog, and adds navigable item, author, and pull-request-files links. Merge readinessKeep open. Current main still dismisses the portaled preview immediately and makes it pointer-inert; this PR repairs that owner boundary and resolves the prior interactive-tooltip concern. A maintainer should confirm the intentional expansion from a reachability fix to a multi-link dialog before landing. Priority: P2 Review scores
Verification
How this fits togetherControl UI detects GitHub item links in chat, requests preview data through the Gateway, and renders a card outside the chat tree. The changed provider coordinates pointer and keyboard state between the source link and that portaled card. flowchart LR
A[Chat GitHub link] --> B[Hovercard provider]
B --> C[Gateway preview request]
C --> D[Portaled preview card]
A --> E[Pointer and keyboard state]
E --> B
D --> F[Open item or profile links]
Decision needed
Why: The reported defect is established, but the four new navigation destinations and dialog focus contract add a user-facing capability beyond restoring reachability. Before merge
Agent review detailsSecurityNone. PR surfaceSource +192, Tests +307. Total +499 across 5 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the portal-boundary traversal repair; retain the interactive dialog only after confirming the added in-card navigation is intended, then land from a green exact head. Do we have a high-confidence way to reproduce the issue? Yes—source reproduction is high-confidence: current main closes on source-link pointer-out while the card is portaled outside the provider and cannot receive pointer events. Is this the best way to solve the issue? Yes for the reachability defect: tracking intent at both the source and portaled-card boundary is the maintainable repair. The added navigation destinations require product confirmation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5626a79cc836. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Added the real-browser proof this review asked for.
All three tests in that file (the original plus these two) pass, run three times locally with no flakes. PR body updated with the run output and a scope note on the title-link commit. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Took the second option from the review: the card is an accessible interactive popover now, and the tooltip contract is gone. The finding was right that a focusable anchor inside What changed in
Pointer behavior is unchanged. The traversal grace repair is untouched: leaving both the link and the card dismisses it after the 120ms grace, and nothing requires a click to close. Proof. The visual gap the review flagged is closed — the PR body now carries a pointer-opened card screenshot and a keyboard-focus-inside-the-card screenshot, both captured from the real Chromium e2e run. Unit coverage is 15 passing, including keyboard traverse, Escape-returns-focus, focus-leaves-both, and the @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Hover intent now spans the link and the portaled card: leaving one for the other keeps the card open through a bounded traversal grace, and only leaving both dismisses it. The card also receives pointer events again, so its text can be selected. Escape, click, focus, viewport, and route-removal dismissals are unchanged, and the close timer is cleared on every close and disconnect.
The preview card's title now renders as an <a> reusing the exact activation href, opening in a new tab like other external Control UI links (buildExternalLinkRel/EXTERNAL_LINK_TARGET). Because the card is portaled to document.body outside the provider's delegated focus listeners, focus landing on the title link needed its own tracking, mirroring the existing pointerenter/pointerleave pattern; that focus hold releases once the pointer leaves the card after a pointer-initiated open, so clicking the title link can never leave a hover-opened card stuck open with the mouse gone.
…eal Chromium Extends the existing github-link-hovercard e2e test with two cases: one drives real page.mouse.move coordinates from the source link, across the gap, onto the portaled card, and confirms it stays open and only closes once the pointer leaves both surfaces; the other clicks the card's title link and confirms the resulting popup navigates to the item URL.
The card declared role="tooltip" while owning a focusable title link. ARIA tooltips are descriptive text: their content is flattened and unreachable, so the link existed for the pointer only. Drop the tooltip contract instead of the link, and give the card the popover semantics its content already needs. The card is now a non-modal role="dialog" named by every render state, and the trigger carries aria-haspopup/aria-expanded/aria-controls in place of the old aria-describedby juggling. Because the card is portaled to document.body it has no tab-sequence neighbour, so Tab from the trigger forwards into it, Tab moves between its links natively, and Tab past either edge or Escape returns focus to the trigger with the card closed and no reopen. The card's other references are links too: the repo reference and the title open the item, the author opens their profile, and a pull request's diff-size chip deep-links to the files-changed view. The title keeps the card's only underline; the rest stay quiet until hovered or focused. Pointer behavior is unchanged - leaving both the link and the card still dismisses it after the traversal grace period, with no click required.
e7526a8 to
7b93f64
Compare
|
Closing out the two rank-up moves from the latest review. The multi-link dialog is the intended product behavior. The interaction model is a deliberate call, not a side effect of the traversal repair: the preview stays interactive, and the card's references become the destinations a reader is already looking for — the title and Exact-head UI checks are green. Run 31915778148 is green on The branch is also rebased onto current |
|
Merged via squash.
|
…openclaw#124274) * fix(ui): keep the GitHub hovercard open while the pointer reaches it Hover intent now spans the link and the portaled card: leaving one for the other keeps the card open through a bounded traversal grace, and only leaving both dismisses it. The card also receives pointer events again, so its text can be selected. Escape, click, focus, viewport, and route-removal dismissals are unchanged, and the close timer is cleared on every close and disconnect. * fix(ui): make the GitHub hovercard title a navigable link The preview card's title now renders as an <a> reusing the exact activation href, opening in a new tab like other external Control UI links (buildExternalLinkRel/EXTERNAL_LINK_TARGET). Because the card is portaled to document.body outside the provider's delegated focus listeners, focus landing on the title link needed its own tracking, mirroring the existing pointerenter/pointerleave pattern; that focus hold releases once the pointer leaves the card after a pointer-initiated open, so clicking the title link can never leave a hover-opened card stuck open with the mouse gone. * test(ui): prove hovercard pointer traversal and title-link click in real Chromium Extends the existing github-link-hovercard e2e test with two cases: one drives real page.mouse.move coordinates from the source link, across the gap, onto the portaled card, and confirms it stays open and only closes once the pointer leaves both surfaces; the other clicks the card's title link and confirms the resulting popup navigates to the item URL. * fix(ui): make the GitHub hovercard an accessible interactive popover The card declared role="tooltip" while owning a focusable title link. ARIA tooltips are descriptive text: their content is flattened and unreachable, so the link existed for the pointer only. Drop the tooltip contract instead of the link, and give the card the popover semantics its content already needs. The card is now a non-modal role="dialog" named by every render state, and the trigger carries aria-haspopup/aria-expanded/aria-controls in place of the old aria-describedby juggling. Because the card is portaled to document.body it has no tab-sequence neighbour, so Tab from the trigger forwards into it, Tab moves between its links natively, and Tab past either edge or Escape returns focus to the trigger with the card closed and no reopen. The card's other references are links too: the repo reference and the title open the item, the author opens their profile, and a pull request's diff-size chip deep-links to the files-changed view. The title keeps the card's only underline; the rest stay quiet until hovered or focused. Pointer behavior is unchanged - leaving both the link and the card still dismisses it after the traversal grace period, with no click required.
Fixes #124270
What Problem This Solves
Fixes an issue where users hovering a GitHub issue or pull request link in Control UI chat could see the preview card but never reach it. The card disappeared the moment the pointer left the link, so moving toward the card destroyed it before the pointer could cross the gap, and its title, author, and diffstat could not be selected or copied. Once the card was reachable, its title still had no way to open the linked issue or pull request.
Why This Change Was Made
Hover intent now spans both surfaces the feature owns. The provider tracks pointer presence over the link, over the card, and focus, and dismissal runs through a single
scheduleClosepath that waits out a bounded 120ms traversal grace and then re-checks all tracked surfaces before closing. Because the card is portaled todocument.body, outside the provider element, it reports its own hover through its ownpointerenter/pointerleavelisteners; the provider's delegated listeners could never have observed it. The card also stops declaringpointer-events: none, which had made it inert to the pointer regardless of lifecycle logic and blocked text selection.The card's title is now an
<a>reusing the exacthrefthe card was activated with (the sameGitHubLinkTargetthe provider already parsed and validated; no new URL parsing was added), withtarget="_blank"and the sharedbuildExternalLinkRel()/EXTERNAL_LINK_TARGEThelpers fromui/src/lib/external-link.ts, matching how other external links in Control UI open. Because the card is portaled outside the provider's delegatedfocusin/focusoutlisteners, focus landing on that link needed its own direct tracking (cardFocusInside), mirroring the existingpointerenter/pointerleavepattern on the card. That focus hold is released whenever the pointer leaves the card after a pointer-initiated open, so clicking the title link (which focuses it) can never leave a hover-opened card stuck open after the mouse moves away; the card still closes on pointer-out with no click-outside required. Keyboard-opened cards (tab focus on the source link) are unaffected: focus-out still closes them as before.This follows the pattern the Control UI already uses for rich tooltips (
ui/src/components/tooltip.ts,shouldRemainOpen/maybeClose); that logic lives inside a Lit component bound to the Web Awesome tooltip and its touch/skip-delay semantics, so it is applied here rather than extracted, which would have cost more surface than it saved.Non-goals and preserved behavior: Escape, click-on-the-source-link, focus-out, viewport scroll/resize repositioning, and the route-removal observer dismiss exactly as before. A pending open that ends before the card exists is still cancelled immediately, so a link the pointer already left never flashes a card. The close timer is cleared on every close and on disconnect, so no timer outlives the element.
Scope note: two commits, one lifecycle
This PR is two commits, not one. The first restores reachability: hover intent across the link and the portaled card, with a bounded traversal grace. The second is a small, separate capability I added at the maintainer's request while the traversal fix was already touching this exact focus/pointer state machine: making the card's title a real, clickable link to the issue or pull request, since a reachable, selectable card that still could not be opened felt like an unfinished half of the fix. It reuses the already-validated href and the repo's existing external-link helpers, and needed only one more piece of state (
cardFocusInside) layered onto the same lifecycle the first commit built, which is why it rides in this PR instead of a follow-up: splitting it out would mean re-deriving the shared traversal/focus contract in a second PR.User Impact
Users can now move the pointer from a GitHub link onto its preview card and keep it open, select and copy the title, author, or diffstat, and read the preview at their own pace. The card's title is now a real link to the issue or pull request, opening in a new tab. The card dismisses when the pointer leaves both the link and the card, whether or not the title link was clicked first. Keyboard users are unaffected: focus still opens the card and Escape still closes it immediately.
Evidence
Unit-level lifecycle proof (jsdom)
Regression test
stays open while the pointer travels from the link onto the cardinui/src/components/github-link-hovercard.test.tsdrives the real lifecycle: hover the link, leave the link with the card asrelatedTarget, assert the card survives the grace window, enter the card and assert it survives ten grace windows, then leave the card and assert it closes and restoresaria-describedby.closes on pointer-out even after the title link inside the card was clickedcovers the added contract: pointer opens the card, pointer moves onto the card, the title link is clicked and focused, then the pointer leaves the card — the card still closes after the grace period with no click-outside needed. The existingrenders and caches pull request detailstest also now asserts the title renders as an<a>with the activationhref,target="_blank", andrelcontainingnoopener noreferrer.Verified failing before the fix by restoring the previous immediate-dismiss path in
handlePointerOut:With the fix in place:
Real-browser proof (Chromium, e2e)
The unit tests above dispatch synthetic pointer events; they cannot show the pointer physically crossing the gap between the link and the card.
ui/src/e2e/github-link-hovercard.e2e.test.tsalready drove a real Chromium page with real mouse geometry for preview rendering and source-link navigation, so this PR extends it with two more real-browser cases instead of adding a second harness:keeps the card open while the pointer crosses the gap onto it, then closes once it leaves both— hovers the real link, waits for the card, then drivespage.mouse.movethrough real intermediate coordinates off the link, through the unowned strip below it, and onto the card body, asserting the card survives every step. It then holds the pointer on the card and confirms the card stays open, and finally moves the pointer off both surfaces with no click and confirms the card closes on its own after the traversal grace period.opens the linked pull request when the card's title link is clicked— opens the card by hover, clicks the title anchor inside the portaled card, and asserts the resulting popup navigates to the exact pull request URL, mirroring the existingpullLink.click()popup assertion for the source link.Run three times in a row locally with no flakes (real Chromium, no synthetic/mocked pointer events for the traversal or click).
Changed-file gates green on the touched files (
node scripts/check-changed.mjs -- ..., exit 0), including the Knip production and full-tree unused-export scans, the coercion helper guard, and format-changed-files.Autoreview (
.agents/skills/autoreview/scripts/autoreview --mode uncommitted) run clean before this push, with no accepted or actionable findings remaining.Production LOC delta is now +102/-6 across
github-link-hovercard.runtime.tsandcomponents.css, of which roughly ten lines are the invariant comments this repo asks for at cross-path lifecycle sites; tests add +217/-4 (unit tests +99/-3, e2e +118/-1 for the two cases above plus their shared setup helper). The growth is the hover-intent capability itself (tracked surfaces, a grace timer, and cleanup) plus the title-link capability described in the scope note above, neither of which any existing shared helper covers.ClawSweeper's "Before merge" checklist on this PR:
ui/src/e2e/github-link-hovercard.e2e.test.tsdrive the actual pointer crossing and the title-link click/navigation, run three times locally with no flakes.Update: the card is now an interactive popover, not a tooltip
The review was right that a focusable link inside
role="tooltip"is not a coherent contract. The tooltip semantics were the wrong half to keep, so they are gone and the card now declares what it actually is.Semantics. The card is a non-modal
role="dialog"with an accessible name in every render state (loading, unavailable, and the full preview). The trigger link carriesaria-haspopup="dialog"plusaria-expanded, flipping totruewitharia-controlsonce the card exists, and the whole set is removed on close. That replaces the previousaria-describedbysave/restore dance, which would have flattened the card's now-interactive content into a description string. This matches the pattern already used for non-modal popovers inui/src/components/terminal/terminal-session-picker.ts(triggeraria-expanded/aria-haspopup="dialog"/aria-controls, surfacerole="dialog"+aria-label).Keyboard. The card is portaled to
document.body, so it has no neighbour in the tab sequence and could never be reached by Tab on its own. Tab from the trigger now forwards focus into the card, Tab moves between the card's own links natively, and Tab past either edge — or Escape from anywhere inside — returns focus to the trigger with the card closed. The returned focus is guarded so the card the user just dismissed cannot reopen under them. Focus leaving both the trigger and the card still closes it.More of the card is now interactive, which is the substance behind the semantics change: the title and the
owner/repo #numberreference open the item, the author avatar and login open that profile, and a pull request's diff-size chip deep-links to the files-changed view. Issues have no files view, so their comment count stays plain text. All of them open in a new tab through the sameEXTERNAL_LINK_TARGET/buildExternalLinkRel()helpers. The title keeps the card's only underline; the rest stay quiet until hovered or focused.Pointer behavior is unchanged. The traversal grace period and its repair are untouched: leaving both the link and the card still dismisses it after 120ms, with no click required to close.
Visual proof
Pointer-opened card:
Keyboard focus inside the card (Tab from the link, then Tab to the title link):
Validation for this change
Unit (
ui/src/components/github-link-hovercard.test.ts, 15 passing) addsmoves keyboard focus through the card's links and hands it back at the edges,closes on Escape from inside the card and returns focus to the link, andcloses once focus leaves both the link and the card, and extends the existing preview case to assertrole="dialog", the trigger's popup attributes, and every card link'shref/target/rel. Against the pre-change runtime these fail for the intended reasons:Real Chromium (
ui/src/e2e/github-link-hovercard.e2e.test.ts, 4 passing) addsexposes the card as a dialog whose title link Tab reaches and Escape leaves, which reads the real accessibility tree withpage.getByRole("dialog"), walks Tab through repo → title → author, presses Escape, and asserts focus returns to the trigger without the card reopening. The click case now also asserts the files chip's popup lands on/pull/99816/files, and that the repo, author, and files links reporttext-decoration-line: nonewhile hovered whereas the title reportsunderline.node scripts/check-changed.mjs -- <touched files>green (UI typecheck, oxlint, UI stylelint, i18n verify, Knip unused-export scans), and autoreview--mode uncommittedclean with no accepted or actionable findings.This lands as a third commit on the branch; the scope note above describes the first two.