fix(gui): open external links in system browser from desktop shell - #426
Open
SerienYang wants to merge 3 commits into
Open
fix(gui): open external links in system browser from desktop shell#426SerienYang wants to merge 3 commits into
SerienYang wants to merge 3 commits into
Conversation
The macOS/Linux webview silently drops target=_blank popups, so links in agent replies (rendered as <a target=_blank> by Markdown.tsx) did nothing when clicked in the packaged app, while the browser dev build worked. Root cause (upstream issue andrewyng#227/andrewyng#270): the shell never registered an opener — no on_new_window handler, no opener plugin, no shell plugin — so the webview's open-new-window request vanished. Fix (port of upstream PRs andrewyng#241/andrewyng#271 + guard): - src-tauri: add tauri-plugin-opener, register it, and add on_navigation that forwards http(s)/mailto to the system browser while letting the SPA itself (tauri://, tauri.localhost, Vite devUrl:1420) load. This also fixes the webview context-menu "Open Link" (issue andrewyng#270). - capabilities: grant opener:allow-default-urls (scoped to mailto:/tel:/http(s)). - tauri.ts: openExternal() now calls __TAURI__.opener.openUrl() in the shell. - Markdown.tsx: route <a> clicks through openExternal() (artifact: chips keep the in-app viewer). - main.tsx: capture-phase fallback for any other <a href> http(s) link (connector cards, dangerouslySetInnerHTML, future surfaces). Verified: tsc --noEmit clean, vitest 7/7, cargo check clean.
…xternal links Left-click was silently dropped because the capability only granted opener:allow-default-urls (a URL scope) without opener:allow-open-url, so the open_url command was rejected by the ACL. Right-click "Open Link" on target=_blank links never reached on_navigation (WKWebView routes them to createWebViewWith), so add an on_new_window handler that opens external URLs in the system browser and denies the new window. Also log openExternal / navigation decisions to make future issues observable.
SerienYang
force-pushed
the
fix/external-links-opener
branch
from
August 3, 2026 10:47
5ec9b24 to
c9a0e99
Compare
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.
$(cat /tmp/pr_body.md)