Skip to content

Open chat links in default browser with external-link icon#225

Merged
oandregal merged 2 commits into
trunkfrom
trusting-banzai-68a2e5
May 21, 2026
Merged

Open chat links in default browser with external-link icon#225
oandregal merged 2 commits into
trunkfrom
trusting-banzai-68a2e5

Conversation

@oandregal
Copy link
Copy Markdown
Contributor

Summary

  • Clicking a link in a chat bubble no longer navigates the Electron window to the external site. Links now open in the user's default browser via shell.openExternal.
  • External (http(s)) links in chat bubbles show a small arrow-out-of-box icon after the link text, signaling they will open externally.

How it works

Renderer (ChatTranscript.tsx): An ExternalLink component is passed to ReactMarkdown's components.a. It intercepts clicks with preventDefault() and routes through the existing window.api.shell.openExternal() IPC channel.

Main process (main.ts): will-navigate and setWindowOpenHandler guards on the BrowserWindow block any navigation away from the app's own origin and open the URL externally instead. This is a safety net for any future code path that might produce clickable links.

CSS (index.css): A ::after pseudo-element with a mask-image SVG renders the external-link icon on .bubble-markdown a[href^="http"]. Anchor-only links (#section) are unaffected.

Test plan

  • Click a link in a chat assistant bubble → opens in default browser, app window stays on the app
  • Verify the small arrow icon appears after external links in chat bubbles
  • Verify anchor-only links (e.g. #section) do not show the icon
  • Verify target="_blank" / window.open() from any source is caught by setWindowOpenHandler

🤖 Generated with Claude Code

oandregal and others added 2 commits May 21, 2026 12:39
Clicking a markdown link in the chat transcript was navigating the app
window to the external site. Add an ExternalLink component that routes
clicks through shell.openExternal, plus will-navigate / setWindowOpenHandler
guards in the main process as a safety net.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CSS-only arrow-out-of-box icon via mask-image on ::after, scoped to
.bubble-markdown a[href^="http"]. Signals the link will open in the
default browser; anchor-only links are unaffected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 21, 2026 11:01
@oandregal oandregal merged commit 55902fa into trunk May 21, 2026
1 check failed
@oandregal oandregal deleted the trusting-banzai-68a2e5 branch May 21, 2026 11:01
@oandregal oandregal review requested due to automatic review settings May 21, 2026 11:23
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