fix(gui): open external links in the system browser via opener plugin by ibell · Pull Request #3231 · CoolProp/CoolProp · GitHub
Skip to content

fix(gui): open external links in the system browser via opener plugin#3231

Open
ibell wants to merge 1 commit into
masterfrom
ihb/gui-opener-links
Open

fix(gui): open external links in the system browser via opener plugin#3231
ibell wants to merge 1 commit into
masterfrom
ihb/gui-opener-links

Conversation

@ibell

@ibell ibell commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Problem

In the Tauri desktop GUI (wrappers/GUI/), the external links in the About dialog (CoolProp repo, GitHub Sponsors, SignPath.io, SignPath Foundation) did nothing when clicked — no browser opened. The header 💚 Sponsor button and the SponsorSplash call-to-action had the same latent bug.

Cause

The links were bare <a href="…" target="_blank" rel="noreferrer"> anchors. In a Tauri v2 webview, default navigation for target="_blank" does not open the system browser, and the opener plugin was never wired up, so the clicks were silently dropped.

Fix

Add tauri-plugin-opener and route every external link through its openUrl() API:

  • src-tauri/Cargo.toml + src-tauri/src/lib.rs — depend on and register tauri-plugin-opener.
  • src-tauri/capabilities/opener.json — new least-privilege capability granting opener:allow-open-url + opener:allow-default-urls (http/https/mailto/tel only) to the main window. Deliberately excludes open-path and reveal-item-in-dir.
  • package.json — add @tauri-apps/plugin-opener.
  • src/components/ExternalLink.tsx (new) — shared anchor that intercepts the click, calls openUrl(href), and keeps href/rel for accessibility and the right-click "copy link" menu.
  • Applied in AboutModal.tsx, the header Sponsor button (App.tsx), and SponsorSplash.tsx.
  • src/test/setup.ts — stub openUrl so jsdom tests resolve cleanly.

src-tauri/gen/schemas/*.json are tauri-build's regenerated ACL manifests reflecting the new capability.

Verification

  • tsc --noEmit clean
  • vitest 21/21 pass
  • cargo check clean (tauri-build validates the capability)
  • ./dev/ci/preflight.sh passed (C/C++ checks correctly skipped — GUI-only diff)

Closes #3230

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • External links now open through the app’s built-in link handler for a smoother, more consistent experience.
    • Sponsor and “About” links across the interface now use the same external-link behavior.
  • Bug Fixes

    • Improved handling of outbound links so they work reliably inside the desktop app.
    • Updated test support to prevent external-link actions from breaking automated checks.

Bare `<a target="_blank">` anchors do not open the system browser in a
Tauri v2 webview, so the About-dialog links (CoolProp repo, Sponsor,
SignPath.io / SignPath Foundation) and the header Sponsor button were
effectively unclickable.

Add `tauri-plugin-opener`, register it, and grant a least-privilege
capability (`opener:allow-open-url` + `opener:allow-default-urls`,
i.e. http/https/mailto/tel only — no open-path or reveal-item-in-dir)
to the main window. Route every external link through a shared
`ExternalLink` component that intercepts the click and calls
`openUrl()`, keeping `href`/`rel` for accessibility and the
right-click "copy link" affordance. Applied in AboutModal, the header
Sponsor button (App.tsx), and the SponsorSplash CTA.

The `src-tauri/gen/schemas/*.json` change is tauri-build's regenerated
ACL manifest reflecting the new capability.

Verified: `tsc --noEmit` clean, `vitest` 21/21 pass, `cargo check` clean.

Closes #3230

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ibell ibell added this to the post v8 milestone Jun 28, 2026
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

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.

GUI: About-dialog and Sponsor links don't open the browser

1 participant