Skip to content

Fix external links/buttons by using opener plugin#127

Merged
tonyantony300 merged 1 commit intotonyantony300:mainfrom
Avazbek22:fix/external-links-not-working-125
Feb 24, 2026
Merged

Fix external links/buttons by using opener plugin#127
tonyantony300 merged 1 commit intotonyantony300:mainfrom
Avazbek22:fix/external-links-not-working-125

Conversation

@Avazbek22
Copy link
Contributor

Description

Fixes #125 by making external links/buttons open reliably in the desktop app.

What changed

  • Added a Tauri-aware external link helper:
    • Uses @tauri-apps/plugin-opener (openUrl) when running in Tauri.
    • Falls back to window.open for non-Tauri/web environments.
  • Wired external link handling to all affected UI links:
    • Footer external buttons (GitHub / Buy Me a Coffee / Website)
    • Settings footer links (Privacy Policy / License)
  • Fixed privacy document URL path from PRIVACY to PRIVACY.md.

Why

In the desktop environment, plain anchor links (target="_blank") may not consistently open in the system browser. Routing link opening through the opener plugin makes behavior consistent across platforms.

Checklist

  • I have run npm run lint before raising this PR
  • I have run npm run format before raising this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

The pull request introduces centralized external URL handling to resolve non-functioning external links. A new utility module provides two functions: openExternalUrl for opening URLs via Tauri opener or browser fallback, and handleExternalLinkClick for delegating click events. Components are updated to wire these handlers, and a URL constant is corrected.

Changes

Cohort / File(s) Summary
External URL Handler Utility
web-app/src/lib/openExternalUrl.ts
New module introducing openExternalUrl() and handleExternalLinkClick() functions to centralize external link handling, with branching logic for Tauri versus browser environments and basic error handling.
Component Updates
web-app/src/components/AppFooter.tsx, web-app/src/components/setting-sidebar/setting-sidebar.tsx
Both components import and wire up handleExternalLinkClick handler to contact and policy links respectively, delegating click behavior to the new external URL utility.
Link Configuration
web-app/src/lib/version.ts
PRIVACY_LINK constant updated to reference the correct path (PRIVACY.md instead of PRIVACY).

Assessment against linked issues

Objective Addressed Explanation
Make external link buttons functional and capable of opening browser navigation [#125]
🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abefafc and 3629cd6.

📒 Files selected for processing (4)
  • web-app/src/components/AppFooter.tsx
  • web-app/src/components/setting-sidebar/setting-sidebar.tsx
  • web-app/src/lib/openExternalUrl.ts
  • web-app/src/lib/version.ts

Comment on lines +9 to +12
const openedWindow = window.open(url, '_blank', 'noopener,noreferrer')
if (openedWindow) {
openedWindow.opener = null
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

openedWindow.opener = null is unreachable in modern browsers; also consider acknowledging popup-blocked failures.

Two related points:

  1. Per the MDN spec and the Firefox implementation, if you use the noopener feature, window.open() will return null even if the window got opened – not only can the new window not talk to you, but you can't talk to it either. Because noopener is already in the features string on Line 9, openedWindow is always null in any modern browser, so the if (openedWindow) branch and the opener = null assignment on Line 11 are dead code.

  2. null is returned if the browser fails to open the new browsing context, for example because it was blocked by a browser popup blocker. In that case, the failure is silently swallowed. Consider logging or surfacing the event so it is at least observable.

♻️ Suggested cleanup
- const openedWindow = window.open(url, '_blank', 'noopener,noreferrer')
- if (openedWindow) {
- 	openedWindow.opener = null
- }
+ const opened = window.open(url, '_blank', 'noopener,noreferrer')
+ if (!opened) {
+ 	console.warn('openExternalUrl: window.open was blocked or failed for', url)
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const openedWindow = window.open(url, '_blank', 'noopener,noreferrer')
if (openedWindow) {
openedWindow.opener = null
}
const opened = window.open(url, '_blank', 'noopener,noreferrer')
if (!opened) {
console.warn('openExternalUrl: window.open was blocked or failed for', url)
}

@tonyantony300 tonyantony300 merged commit 33c8970 into tonyantony300:main Feb 24, 2026
3 checks passed
@tonyantony300
Copy link
Owner

Thank you for this contribution @Avazbek22 !!

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.

Bug: External links/buttons are not working

2 participants