Skip to content

Open open new link should not navigate away from current link - #18873

Merged
AmethystLiang merged 10 commits into
mainfrom
open-open-new-link-should-not-navigate-away-from-current-link
Sep 6, 2026
Merged

AmethystLiang merged 10 commits into
mainfrom
open-open-new-link-should-not-navigate-away-from-current-link

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​352 $\color{#cf222e}{\Huge{\mathbf{−}}}$​170 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​151 $\color{#cf222e}{\Huge{\mathbf{−}}}$​89 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​62

ELI5

What Changed

Why

Linked Issue

Fixes #

Visual Proof

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 0d4eef03-a913-4636-81f2-e1253c4e86b9

📥 Commits

Reviewing files that changed from the base of the PR and between a700829 and c988ecd.

📒 Files selected for processing (1)
  • tests/e2e/browser-tab.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change separates foreground and background clicked-link routing for main frames and iframes. Popup handling now propagates tab activation state through the manager, preload API, and renderer IPC bridge. In-Orca popup notices are suppressed. Context-menu and remote-link tab creation now avoids activation. Browser tabs display loading icons. Unit and end-to-end tests cover foreground, background, modifier, middle-click, iframe, and Shift+middle-click behavior.

Merge Risk: ⚪ Minimal · up to c988e

Link-opening gestures now preserve the current tab for background opens while retaining foreground behavior for Shift+middle-click. The implementation and associated test coverage indicate no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the template headings but provides no substantive explanation, linked issue, visual proof, testing details, AI disclosure, review information, or completed checklist items. Complete each required section with implementation details, rationale, and testing results. Add a valid linked issue after “Fixes #”. Attach before-and-after visual proof or write “N/A” with a reason. Report manual and automated testing, co…
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 26 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title describes the main behavior change: opening a new link must not navigate away from the current link. The repeated word “open” is a minor wording issue but does not make the title misleading.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Resolution

Complete each required section with implementation details, rationale, and testing results. Add a valid linked issue after “Fixes #”. Attach before-and-after visual proof or write “N/A” with a reason. Report manual and automated testing, complete applicable checkboxes, and document cross-platform, SSH, security, compatibility, and performance considerations.

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch open-open-new-link-should-not-navigate-away-from-current-link

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one test-reliability rough edge inline.

Reviewed changes

  • Foreground vs background clicked-link routing — browser-clicked-link-routing.ts now carries distinct foreground/background frame names and routes modifier-click and middle-click to the background while Shift+modifier/Shift+middle stays foreground, matching Chrome.
  • activate passthrough to the renderer — openLinkInOrcaTab takes an optional activate flag, forwarded over browser:open-link-in-orca-tab and mapped onto createBrowserTab({ activate }) (defaulting to foreground), with background-tab disposition routed to background.
  • Tests — unit coverage for frame-name selection in both the isolated-world and iframe paths plus the renderer bridge, and an expanded e2e spec asserting overlay opacity for background vs foreground tabs.

The production change is sound: the foreground/background frame-name mapping, the disposition !== 'background-tab' fallback, and the activate ?? true renderer default are all consistent and backward-compatible (the IPC field is optional and defaults to foreground). The one concern is in the new e2e helper, noted inline.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread tests/e2e/browser-tab.spec.ts Resolved
@AmethystLiang
AmethystLiang force-pushed the open-open-new-link-should-not-navigate-away-from-current-link branch from 3d87958 to 098cbe4 Compare September 5, 2026 20:16

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one test-coverage gap inline.

Reviewed changes

  • Silenced opened-in-orca popup toasts — formatPopupNotice now returns null for links opened in Orca tabs, and both consumers (useBrowserClientHostedPopupNotices, useBrowserPageResourceNotices) skip a null notice, so only external and blocked popup outcomes still surface.
  • Background context-menu opens — "Open Link In Orca Browser" now opens in the background via activate: false (local pane) and focusOnCreate: false (remote pane through openWorkspaceBrowserTab).
  • e2e hardening — introduced waitForTabIdByExactTitle (exact-title match) shared by both tab assertions, addressing the prior substring-match concern, and expanded the spec to cover context-menu, frame, and Shift+middle-click gestures.

The delta is sound: the popup-notice silencing is consistent across both consumers, and the background-activation flags align with the createBrowserTab/openWorkspaceBrowserTab contracts (focusOnCreate: false maps to activate: false). The one remaining concern is test coverage, noted inline.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread tests/e2e/browser-tab.spec.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

Commit 2927c4b bundles five files outside this PR's scope — a CI workflow, three docs files, and package.json — likely from a stray git add -A or a formatter run with different settings. They should be dropped before merge.

Reviewed changes

  • Animated loading spinners — BrowserFavicon gained a loading prop that renders a spinning Loader2 in place of the favicon, and BrowserTab / ClientHostedBrowserTab replaced their blue loading dot with it.
  • Main-frame target=_blank e2e coverage — the link server was extracted to tests/e2e/helpers/browser-link-server.ts, and the spec now asserts a plain main-frame target=_blank click opens "Blank target destination" while the source tab keeps its "Source page" content, closing the coverage gap from the prior review.
  • Full gesture matrix — the spec now distinguishes foreground (plain / Shift) from background (modifier / middle / context-menu) opens across the main frame and iframe.

⚠️ Unrelated files bundled into the test commit

Four of the five files are formatting-only churn, but the package.json change removes a flag main deliberately added — and does so in the wrong direction.

Technical details
# Remove unrelated files from the PR

## Affected sites
- `package.json` — drops `--disable-warning=MODULE_TYPELESS_PACKAGE_JSON` from `bench:terminal-partial-escape-tail`. `main` currently carries two copies of that key (a pre-existing duplicate: one flagged, one plain); the correct cleanup keeps the flagged line and removes the plain duplicate, not the reverse.
- `.github/workflows/cloud-deploy-relay-production-director.yml` — `description` value re-quoted `"…"` → `'…'`.
- `docs/reference/windows-edr-posture.md`, `docs/site/content/docs/install.mdx`, `docs/site/content/docs/remote-servers.mdx` — emphasis flipped `*…*` → `_…_` and tables re-wrapped. `main` uses `*…*`, so this reverts `main`'s markdown convention.

## Required outcome
- Drop all five files from the PR so only the spinner and browser-link changes remain. If the `package.json` duplicate-key cleanup is wanted, do it separately and keep `--disable-warning=MODULE_TYPELESS_PACKAGE_JSON`.

## Open questions for the human
- Were these introduced by a stray `pnpm format` / `git add -A`, or is the branch stale against `main`?

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Localized clicked-link frame names — the foreground/background frame-name pair is now generated inside installGuestPopupPolicy (which takes a single routeClickedLinks boolean) instead of being stored in the per-guest clickedLinkFrameNameByGuestId / clickedLinkFrameNamesByGuestId state maps, both of which are deleted.
  • Dropped four of the five unrelated files — the CI workflow and three docs files flagged in the prior review are gone.
  • Hardened tests — popup-routing and lifecycle tests now assert activate: false on background routing and verify listener teardown by reading the injected script rather than peeking at the removed private maps.

The refactor is behavior-preserving: frame-name randomness, the foreground/background activate resolution in handleDidCreateWindow, and the one-use iframe token handling are all unchanged. The 48 touched unit tests pass locally.

One carried-forward note, not blocking: package.json still contains the unrelated bench:terminal-partial-escape-tail duplicate-key cleanup (it drops the --disable-warning=MODULE_TYPELESS_PACKAGE_JSON variant, keeping the plain duplicate). Against main this is behavior-neutral because JSON last-key-wins already resolved that key to the plain line, but it is the one leftover of the five files the prior review asked to drop, so consider removing it to keep the PR scoped.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Shift held for middle-click gestures — clickBrowserLink now synthesizes a real Shift keyDown/keyUp around the click sequence instead of only passing modifiers: ['shift'] on the mouse events, so the Shift + middle-click e2e cases actually exercise the foreground routing path rather than resolving shiftKey as false and routing to the background.

The delta is a focused, test-only fix: without a held Shift key the isolated-world click listener never observes shiftKey, so the foreground assertions (expectBrowserTabActive) could only pass by accident. The keyDown/keyUp are wrapped in try/finally so a mid-sequence throw still releases the modifier. No production code changed.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Dropped the duplicate main-frame shift+middle e2e gesture — removed the #shift-middle-link block from tests/e2e/browser-tab.spec.ts, leaving the #frame-shift-middle-link foreground assertion in place. The main-frame shift+middle→foreground routing stays covered by the it.each unit test in browser-clicked-link-routing.test.ts, and the isolated-world path remains e2e-covered via the modifier/middle/blank-link gestures.

ℹ️ Nitpicks

  • tests/e2e/helpers/browser-link-server.ts still defines the now-unused #shift-middle-link fixture and the Shift middle destination title branch (the /source handler). Harmless, but worth removing so the fixture doesn't imply a main-frame shift+middle case that's no longer asserted.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang force-pushed the open-open-new-link-should-not-navigate-away-from-current-link branch from 3c34743 to 2e6a8fa Compare September 6, 2026 03:48

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Favicon reload-spinner test correction — browser-favicon.test.tsx reworked the two loading/reload tests to assert the new spinner behavior: shows a loading spinner throughout a reload now verifies the <img> is unmounted and a motion-safe:animate-spin element is present during a reload, and shows the favicon when initial loading finishes drops the fireEvent.error(container.querySelector('img')!) call that would have thrown (no <img> exists while loading renders the Loader2).

The delta is test-only and correct: both tests now exercise the Loader2 spinner path introduced by the earlier spinner commit, and the removed fireEvent.error(null!) call was a latent throw rather than a real assertion. No production code changed.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Links opened with modifier keys (Cmd/Ctrl+click) and middle-click now open
in background tabs, matching Chrome's behavior. Shift+middle-click continues
to open in the foreground tab. The routing system now tracks separate
foreground and background frame names, with an `activate` flag controlling
whether the new tab is brought to focus.
When opening links via context menu or other mechanisms that create background tabs, keep focus on the source tab rather than automatically switching to the newly opened tab. Set `activate: false` on tab creation to prevent unwanted navigation away from the current page.
Links that open in new Orca tabs are immediately visible to the user and
don't warrant a toast notification. Only external popup opens now show
notifications, reducing unnecessary clutter while still alerting the user
to unexpected external window opens.
Replaces the small dot indicators with animated Loader2 icons that
appear in place of the favicon while tabs are loading. Provides
clearer, more prominent visual feedback during navigation.
Add a test case checking that plain main-frame target=_blank clicks open
in a new tab without navigating the source tab away. Extract
startBrowserLinkServer to a helper module and add the /blank-destination
endpoint to support the new test case.
Remove the global clickedLinkFrameNamesByGuestId state map and generate
frame names locally within installGuestPopupPolicy, improving state
encapsulation and simplifying cleanup logic. Functionality unchanged.
Updated test expectations to reflect that the favicon component shows a
loading spinner during reload instead of keeping the previous image
mounted.
@AmethystLiang
AmethystLiang force-pushed the open-open-new-link-should-not-navigate-away-from-current-link branch from 891eaee to f20dce2 Compare September 6, 2026 04:24
@AmethystLiang
AmethystLiang merged commit f811ee0 into main Sep 6, 2026
20 of 27 checks passed
hwantage added a commit to hwantage/orca that referenced this pull request Sep 6, 2026
Keep the background-tab behavior introduced by stablyai#18873 when resolving
the link context-menu and browser gesture test conflicts.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ai#18873)

* fix(browser): open modifier-click and middle-click links in background t

Links opened with modifier keys (Cmd/Ctrl+click) and middle-click now open
in background tabs, matching Chrome's behavior. Shift+middle-click continues
to open in the foreground tab. The routing system now tracks separate
foreground and background frame names, with an `activate` flag controlling
whether the new tab is brought to focus.

* fix(browser): don't navigate away when opening links in background tabs

When opening links via context menu or other mechanisms that create background tabs, keep focus on the source tab rather than automatically switching to the newly opened tab. Set `activate: false` on tab creation to prevent unwanted navigation away from the current page.

* fix(browser): silence popup notices for links opened in Orca tabs

Links that open in new Orca tabs are immediately visible to the user and
don't warrant a toast notification. Only external popup opens now show
notifications, reducing unnecessary clutter while still alerting the user
to unexpected external window opens.

* Replace loading dots with animated spinner icons

Replaces the small dot indicators with animated Loader2 icons that
appear in place of the favicon while tabs are loading. Provides
clearer, more prominent visual feedback during navigation.

* test(browser-tab): verify target=_blank links don't navigate source tab

Add a test case checking that plain main-frame target=_blank clicks open
in a new tab without navigating the source tab away. Extract
startBrowserLinkServer to a helper module and add the /blank-destination
endpoint to support the new test case.

* refactor(browser): localize clicked-link routing frame names

Remove the global clickedLinkFrameNamesByGuestId state map and generate
frame names locally within installGuestPopupPolicy, improving state
encapsulation and simplifying cleanup logic. Functionality unchanged.

* test(browser-tab): hold shift for middle-click gestures

* test(browser-tab): drop duplicate shift-middle gesture

* test(browser-favicon): verify spinner shown while favicon reloads

Updated test expectations to reflect that the favicon component shows a
loading spinner during reload instead of keeping the previous image
mounted.

* fix ci
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.

1 participant