feat(desktop): open external links in system browser instead of webview #8523
+68
−6
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
Fixes #8361
This PR fixes the issue where clicking links in AI responses navigates inside the Tauri webview instead of opening in the system browser.
What makes this PR different from #8520 and #7360:
Changes
<a>tag clicks withhttp://orhttps://URLs and opens them viashellOpen()in the system browserlinks.openExternallyto Layout context (persisted) so users can toggle between external browser and in-app navigationProblem
In Tauri webview,
target="_blank"on<a>tags does NOT automatically open links in the system browser. When users click links from:<a>tags (like the feedback button)...the webview navigates to that URL, and users get "stuck" with no obvious way to return.
Solution
Added a global click handler that:
<a>tags with external URLswindow.__OPENCODE__.openLinksExternally)shellOpen()Testing
bun devinpackages/opencodeFiles Changed
packages/desktop/src/index.tsxpackages/app/src/context/layout.tsxwindow.__OPENCODE__packages/app/src/app.tsxwindow.__OPENCODE__packages/app/src/pages/layout.tsxDefault Behavior
Opens links in external browser (most users expect this behavior)
Users who prefer in-app browsing can toggle the setting.