Skip to content

feat: open external links in a new tab on web - #170

Open
devs-rootstrap wants to merge 1 commit into
masterfrom
feat/web-links-new-tab
Open

devs-rootstrap wants to merge 1 commit into
masterfrom
feat/web-links-new-tab

Conversation

@devs-rootstrap

Copy link
Copy Markdown
Collaborator

Jira board reference:


What does this do?

On web, the Settings links (Terms of Service and Website) now open the URL in a new browser tab instead of navigating to the in-app WebView screen (/www). iOS and Android keep the current behavior.

  • New LinkItem settings component (src/components/settings/link-item.tsx):
    • Web: renders the row as a real anchor (<a href target="_blank" rel="noopener noreferrer">) through react-native-web's href/hrefAttrs, so the browser handles it natively (new tab, middle-click, "copy link address", link semantics).
    • iOS/Android: keeps the existing Link to /www with the url and title params.
  • Item accepts two optional props: role and a web-only externalHref, which turns the row into an anchor. Existing usages are unchanged.
  • The Settings screen uses LinkItem for both links. The max-lines-per-function disable comment was removed because it is no longer needed.

Why did you do this?

react-native-webview is not meant for the browser, so opening Terms/Website inside the app on web adds nothing and breaks the expected browser behavior. A real anchor with target="_blank" is the most robust option on web: popup blockers don't apply to it, and it keeps native link behavior without extra JS.

Who/what does this impact?

  • Web users of the Settings screen: the two links now open in a new tab, and the app stays on Settings.
  • iOS/Android: no behavior change.
  • src/app/www.tsx is untouched. This should merge cleanly next to refactor(router): move screen options from layouts into screen files #157, which only adds a Tabs.Screen block in settings.tsx and rewrites www.tsx; a small conflict in the imports of settings.tsx is possible.

Layer 2: Risk Classification

Author applies a risk label when opening the PR. When in doubt, escalate.

Label When to use
risk:low Config, copy, minor UI tweaks. Low blast radius.
risk:medium Feature work, refactors touching multiple files.
risk:high Auth, payments, migrations, security-sensitive code.

Setup

  • Create risk:low, risk:medium, risk:high labels in the repo
  • Add risk criteria to contributing guide or PR template
  • Add reminder in PR template to apply the label before requesting review
  • Define who can override/escalate (suggested: tech lead)

How did you test this?

  • Tested on iOS
  • Tested on Android
  • Tested on a small device
  • Tested on a real device
  • Tested all flows related with this PR changes
  • Tested accessibility
  • Added tests

Verification

  • pnpm lint: passed
  • pnpm type-check: passed
  • pnpm lint:translations: passed
  • pnpm test: 29 suites, 142 tests passed
  • New __tests__/components/settings/link-item.test.tsx covers the web anchor (role, href, target/rel) and the /www navigation on iOS and Android.
  • Not yet verified in a browser or on a device/emulator.

How to test locally

  1. git fetch origin && git checkout feat/web-links-new-tab && pnpm install
  2. pnpm web, sign in and open Settings.
  3. Click Terms of Service and Website: each should open in a new browser tab while the app stays on Settings. Middle-click and right-click → "Copy link address" should also work.
  4. On pnpm ios / pnpm android, the same items should still open the in-app WebView.

Notes:

Assumptions:

  • Only the links that go through the /www WebView screen are in scope. Today those are the two Settings links (Terms of Service and Website).
  • Deep-linking directly to /www on web is left as is.

Screenshots / Previews

N/A

@devs-rootstrap
devs-rootstrap requested a review from a team as a code owner November 11, 2026 12:15
@devs-rootstrap
devs-rootstrap requested review from amaury901130, asdolo and fernandatoledo and a balanced review from Copilot November 11, 2026 12:15
@devs-rootstrap devs-rootstrap added the risk:low Config, copy, minor UI tweaks. Low blast radius. label Nov 11, 2026
@github-actions

Copy link
Copy Markdown

💯 Test Coverage

Lines Statements Branches Functions
Coverage: 57%
56.52% (351/621) 60% (180/300) 48.97% (119/243)

😎 Tests Results

Tests Skipped Failures Errors Time
142 0 💤 0 ❌ 0 🔥 33.376s ⏱️
👀 Tests Details • (57%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files56.526048.9757.19 
src/app/(app)37.544.442037.5 
   settings.tsx000026–88
src/components/settings22.8510018.7524.24 
   item.tsx100100100100 
   link-item.tsx100100100100 

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The navigation test can pass without handling the press because it matches a render-time mock call; clear the mock before pressing to verify onPress forwarding.

1 open issue
What changed in this PR

Overall Review: ai:minor

Updates Settings external links to open in new browser tabs on web while preserving in-app WebView navigation on iOS and Android.

Changes:

  • Adds a platform-aware LinkItem and anchor support to settings rows.
  • Migrates Terms of Service and Website links to the shared component.
  • Adds tests for web link attributes and native navigation.
File Description
src/​components/​settings/​link-item.tsx Selects web anchors or native /www navigation.
src/​components/​settings/​item.tsx Adds optional role and external anchor props.
src/​app/​(app)/​settings.tsx Uses LinkItem for both external links.
__tests__/​components/​settings/​link-item.test.tsx Tests web attributes and iOS/Android navigation.

Review effort: Balanced

setPlatformOS(os);
render(<LinkItem text="settings.terms" url={URL} />);

fireEvent.press(screen.getByText('Terms of Service'));

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Config, copy, minor UI tweaks. Low blast radius.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants