Skip to content

feat(items): show the GitHub preview card when hovering an item's PR or issue link chip - #48003

Merged
AmethystLiang merged 7 commits into
mainfrom
AmethystLiang/fix-github-link-hover
Nov 24, 2026
Merged

AmethystLiang merged 7 commits into
mainfrom
AmethystLiang/fix-github-link-hover

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On a bot item's page, hovering a PR or issue link chip now shows the same GitHub preview card that PR and issue links in chat already show, instead of a one-line dark tooltip.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1107 $\color{#cf222e}{\Huge{\mathbf{−}}}$​187 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​920

What Changed

Before: hovering or focusing a PR/issue chip in the item header showed a plain tooltip: title · state · checks · repo.

After: the chip opens the existing chat GitHub card (NativeChatLinkPeek): repo and number, state badge, title, labels, author, last update and diff size. It keeps the card's open delay and dismissal; the card opens below the chip and flips when there's no room. File, command and web chips keep their tooltip. With no repo or host to read GitHub through, a GitHub chip keeps its tooltip too.

  • "+N" list: a GitHub row in the overflow popover shows the same card. It opens beside the list (left if it fits, else right, else below the row), sits above the popover so its Retry is clickable, and picks its side again if the window resizes while it is open.
  • Before the lookup answers: the card shows what the chip already knows (title; state · checks · repo), never an empty card or a skeleton.
  • If the lookup fails: the card shows the title plus "Preview unavailable. Retry", without the chip's older state or checks. A retry keeps that layout until it answers, so the card doesn't shrink out from under the pointer.
  • Keyboard: Tab opens the card as hover does. Hover-card content is never in the tab order, so while the chip has focus and its card shows a failure, R retries. The key is shown beside Retry and announced to screen readers. A retry's key presses never reach the item's comment draft; any other key still types into it as before.
  • Narrow windows: the card never runs past the window. It scrolls when taller than the space available, long labels truncate, and the repo name and labels show in full on hover.
  • Mechanism: the item header wraps its chips in NativeChatLinkPeekProvider, pinned to the bot's own host, so a folder with the same id on another paired host can't answer the bot's links. NativeChatLinkPeek gains opt-in props for this (side, githubFallback, githubFailedFallback, retryKey, overPopover). Chat links pass none and behave as before, except for the two that every link card gets: a retry keeps its layout, and the card is capped at the window's height.

Why

The owner asked for the item page's PR chip to show the GitHub preview on hover. Reusing the chat card keeps one GitHub preview across the app instead of building a second one. Checked against how comparable products handle this (open delay, hovering into the card, placement).

Linked Issue

None (maintainer change).

Visual Proof

Seeded component fixtures with invented data only.

Light Dark
Before (tooltip) before-hover-pr.light.png before-hover-pr.dark.png
After (GitHub card) hoverOpenPr.light.png hoverOpenPr.dark.png

Failed lookup, with the R hint:

failed-card-with-key.light.png

"+N" row card, beside the list:

overflow-card-left-of-list.light.png

Testing

  • I manually tested these changes locally (macOS, Chromium-rendered component fixtures driven with real pointer and keyboard input)
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

The fixtures in BotItemLinkChips.fixture.tsx (data in bot-item-link-chips-fixture-data.tsx) were driven with page.mouse and page.keyboard, with a lookup that can be held, failed or answered on demand, and with the item pane's type-to-comment handler mounted. Checked:

  • the open delay (no card at 150 ms, card at 650 ms); hovering into the card keeps it open, leaving closes it, a quick pass-through never opens it
  • Tab opens the card; the first Escape closes only the card, the second reaches the pane; click and Enter open the link once
  • the issue card; the file chip keeps its tooltip
  • the "+N" card's Retry at 1600, 1200 and 310 px wide; resizing from 1200 to 360 px with the card open keeps all four edges inside the window
  • a 241×161 window
  • R retry: exactly one request per press, ignored while the retry runs and for a held key's repeats, the draft left untouched

Unit tests: link-peek-side.test.ts (which side has room) and has-github-link-peek.test.ts (a chip drops its tooltip exactly when the card shows).

Performance

None, because the card only renders while a link is hovered or focused, and the lookup is the existing cached GitHub preview read that chat links already use. The header adds one context provider per item page (a store selector memoized on its inputs); the resize listener exists only while a "+N" card is open.

Risk

The riskiest part is the shared NativeChatLinkPeek, used by every chat link. Chat links pass none of the new props, so the only changes they see are that a retry keeps the failed layout until it answers and that the card is capped to the window's height. If something went wrong, item chips would fall back to no preview or their tooltip, and chat link cards could misplace a Retry. A plain revert backs it out; nothing is persisted.

Level: Low

…y in every layout

- Checks show only when confirmed for the PR the lookup returned
- In the +N list the card opens beside the list, above the popover, so Retry takes the click
- The card never runs past the window: it scrolls, and long labels truncate
…d keeps to the window and its own layer

- A focused chip or +N row whose card failed takes R to retry; the key is shown and announced
- An open card picks its side again when the window resizes
- Only a card over the +N popover sits above popovers
- The loaded card shows no CI: the lookup carries none, and the chip's reading may be stale
- Full repo name and labels on hover
… until it answers

- While a retry runs the failed card keeps its layout and its (inert) Retry, so the pointer and focus
  stay on it and no neighbouring row's card takes over
- R is the card's while it has failed or is retrying, never typed into the item's draft; a held key
  retries once
- Fixture data moves to bot-item-link-chips-fixture-data.tsx, with a held lookup and the pane's
  type-to-comment handler for probing
Once R retried a failed GitHub card, its auto-repeats are swallowed until keyup (or blur), even after
the retry answers, so they never type into the item's draft.
- Pending Retry uses the link-muted Button variant instead of raw classes
- The link card scrolls in an inner scrollbar-sleek wrapper, not on HoverCardContent itself
- sideWithRoom takes a minimal box reader, so its test needs no cast
- Fixture data file renamed to bot-item-link-chips-fixtures.tsx (test-only name)
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds native GitHub link previews to bot item chips and rows. Preview cards support fallback content, keyboard retry, and placement that adapts to available space. Repository lookup can use a specified execution host. New fixtures cover preview states, retry interactions, keyboard and pointer behavior, and narrow layouts. Tests cover GitHub preview detection and card-side selection.

Merge Risk: Minimal · up to 1d41e

This change shows a GitHub preview card when hovering PR or issue chips in bot items, with fallback and retry behavior. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the item header's PR/issue link chip now shows the GitHub preview card on hover, which the changeset implements through BotItemLinkChips, BotItemGitHubChip, and Native…
Description check Passed The description follows the repository template closely. It has ELI5, What Changed (before and after, mechanism), Why, Visual Proof with before and after images for light and dark themes, Testing with…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the item header's PR/issue link chip now shows the GitHub preview card on hover, which the changeset implements through BotItemLinkChips, BotItemGitHubChip, and NativeChatLinkPeek changes. The title is specific and follows a conventional commit style. It is slightly long at 87 characters, but it is accurate and readable.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed (before and after, mechanism), Why, Visual Proof with before and after images for light and dark themes, Testing with checked boxes and detailed manual verification, Performance with a reasoned 'None, because' line, Risk with a level and a revert path, and a Notes section. The Linked Issue section says 'None (maintainer change)', which is a deviation from the template's requirement to link an issue. The AI Disclosure and Agent skill upstream boundary sections are left unaddressed. The Review section is empty. These gaps are non-critical for a maintainer PR, so the check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 766e706d-c3f9-4951-af77-9a4fe62362af
Commits

Reviewing files that changed from the base of the PR and between 251c45e and 1d41edd.

Files selected for processing: 6

  • src/renderer/src/components/bots/items/BotItemLinkChips.fixture.tsx
  • src/renderer/src/components/bots/items/bot-item-link-chips-fixtures.tsx
  • src/renderer/src/components/native-chat/links/previews/NativeChatGitHubLinkPeek.tsx
  • src/renderer/src/components/native-chat/links/previews/NativeChatLinkPeek.tsx
  • src/renderer/src/components/native-chat/links/previews/link-peek-side.test.ts
  • src/renderer/src/components/native-chat/links/previews/link-peek-side.ts
Files with no reviewable changes: 1

  • src/renderer/src/components/bots/items/bot-item-link-chips-fixtures.tsx
Files skipped from review as they are similar to previous changes: 1

  • src/renderer/src/components/native-chat/links/previews/NativeChatGitHubLinkPeek.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@AmethystLiang
AmethystLiang merged commit 212a1f7 into main Nov 24, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant