Open chat links in default browser with external-link icon#225
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shell.openExternal.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): AnExternalLinkcomponent is passed to ReactMarkdown'scomponents.a. It intercepts clicks withpreventDefault()and routes through the existingwindow.api.shell.openExternal()IPC channel.Main process (
main.ts):will-navigateandsetWindowOpenHandlerguards 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::afterpseudo-element with amask-imageSVG renders the external-link icon on.bubble-markdown a[href^="http"]. Anchor-only links (#section) are unaffected.Test plan
#section) do not show the icontarget="_blank"/window.open()from any source is caught bysetWindowOpenHandler🤖 Generated with Claude Code