Skip to content

Open new-window links as tabs and ask before opening other apps - #253

Merged
rafiki270 merged 12 commits into
mainfrom
fix/popup-external-scheme-and-tab-handoff
Nov 23, 2026
Merged

rafiki270 merged 12 commits into
mainfrom
fix/popup-external-scheme-and-tab-handoff

Conversation

@rafiki270

Copy link
Copy Markdown
Contributor

Summary

  • New windows open as tabs. target="_blank" links and window.open(url) without a size now open a selected tab in the same browser window and storage partition, instead of the pop-up window or sheet added in Open sign-in pop-ups across Kelpie platforms #251. Opens that ask for a window size (sign-in providers) keep the native pop-up. Links opened from inside a pop-up become tabs in the main window and survive the pop-up closing.
    • WebKit (macOS, iOS): WebKitWindowPolicy.placement(for:) treats any x, y, width or height in WKWindowFeatures as a pop-up. The tab hosts WebKit's own context, so window.opener works where WebKit keeps it (noopener and plain _blank links drop it), and window.close() closes a script-opened tab.
    • Android: onCreateWindow(isDialog = false) hands a new tab's WebView to WebViewTransport.
    • Chromium (macOS, Windows, Linux): OnBeforePopup cancels non-NEW_POPUP opens with an http(s) URL and replays them as a tab. Blank windows a page fills later stay pop-ups. Replay has no window.opener, and a form POST to a new window becomes a GET. Desktop partition lookup fails closed. macOS Chromium pop-ups keep opening pop-ups, as before.
  • App links ask first. Navigations to schemes the engine cannot load (slack:, zoommtg:, mailto:, tel:, Android intent:) are cancelled and confirmed with a native prompt naming the requesting origin, and on desktop the app the OS resolved. Only the main frame or a same-origin frame may ask. Without a click a document may ask once, so launch pages work and loops do not; WebKit counts a click, tap or key press from the last 2 s once, because it reports only link clicks as activation.
    • macOS: ExternalAppPrompt sheet, opens the named app with NSWorkspace.
    • iOS: alert, then UIApplication.open.
    • Android: intent: URLs are rebuilt as a clean ACTION_VIEW intent (data, package, CATEGORY_BROWSABLE; no component, selector, extras or flags); file:/content: data is refused; browser_fallback_url loads when no app matches.
    • Windows/Linux: DesktopCefClient::OnBeforeBrowse posts to a shell prompt (MessageBoxW + ShellExecuteW, GTK dialog + GAppInfo). Chrome's denied schemes (shell:, vbscript:, ms-msdt: …) never reach the OS.
  • Unchanged: sized pop-ups, sign-in round trips and the iOS external-display surface (tab-like opens load in place, as before Open sign-in pop-ups across Kelpie platforms #251).
  • Docs: docs/functionality.md, docs/api/partitions.md, design note with the Codex cross-provider review in docs/plans/2026-11-23-new-window-tabs-and-external-apps.md.
  • Versions: macOS 0.2.24 (52), iOS 0.2.16 (38), Android 0.2.20 (40), Windows 0.2.17, Linux 0.2.19.

Screenshots

Before After
iPhone. A target="_blank" workspace link opened the launch page in a pop-up sheet and the page's slack: link did nothing. iPhone before: launch page in a pop-up sheet iPhone. The link opens a full tab and the page asks to open Slack. iPhone after: launch page in a tab with the app prompt

macOS shows the same change: the tab opens in the main window and a sheet reads "Open “Slack”?" with "Open Slack" / "Cancel". This environment cannot capture macOS windows, so the sheet's text is checked by ExternalAppPromptTests instead of a screenshot.

Testing

Fixture: a workspace page with a _blank link, window.open() with and without a size, a launch page that redirects to an app link on load, and a "Launch app" button.

  • macOS (dictator): SwiftLint passed. WebKit and Chromium driven through the embedding host's control API: link → selected tab, plain window.open keeps opener, sized open → pop-up window, a pop-up's link → tab in the main window that survives the pop-up closing, sign-in result returned, app-link sheet shown once per document. New tests pass: WebKitNewWindowTests (6), ExternalAppPromptTests, WebKitPopupTests. The full suite ran 295 tests with one failing case, BrowserControlGatewayTests.testAuthenticatedRoutesUseCanonicalEnvelopeAndCompactMCP, which fails identically on origin/main.
  • iOS (iPhone 17 simulator, iOS 26.5): WebKitPopupTests (3) pass. Tapped through the fixture: tab, prompt, in-tab "use Slack in your browser", the second automatic request suppressed, and a tapped "Launch app" button asking again.
  • Android (Maxis, API 35 emulator): Gradle lint, ktlint, build and test APKs pass. ExternalAppLinksTest (3) and WebPopupFlowTest (2) pass. Driven through the API: tab, dialog, Open launched the dialer, once-per-document rule, and an intent: link for a missing app loaded its fallback page.
  • Windows (Maxis): build passed; CTest 77/77 with close_tab_control_surface_test run in the desktop session (it cannot start under SSH while another Kelpie holds the single-instance mutex). Driven through the API: tab, Open "Settings"? dialog for an ms-settings: link, cancel kept the page, sized pop-up as a native window, a pop-up's window.open became a tab, sign-in result returned.
  • Linux (Fedora 44 VM): build passed with CEF 158; engine tests 9/9 (incl. test_new_window_policy) and app tests 56/56. Not verified by hand: http(s) pages never load in this VM for either this build or the installed 2026.11.22 release (data: URLs do), so the GTK prompt and tab replay were not exercised in a running app.
  • Repository checks: embedding, Mac signing plan, app update, engine update and profile migration checks, pnpm lint.

🤖 Generated with Claude Code

Ondrej Rafaj and others added 11 commits November 23, 2026 10:18
…ple platforms

Links with target=_blank and window.open() without size now open a
selected tab in the opener's window and partition. Opens that ask for
window geometry keep the native pop-up. Links to other apps (slack:,
mailto:) are cancelled and confirmed with a sheet or alert naming the
requesting site; a page may ask once per document without a click.

Covers macOS WebKit and Chromium and iOS. Chromium replays tab-like
opens from their URL because CEF cannot hand its context to a tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…droid

onCreateWindow without isDialog hands the WebView of a new selected tab
to WebViewTransport, so the engine keeps its opener relationship.
App links are cancelled in shouldOverrideUrlLoading and confirmed with a
dialog; intent: URLs are rebuilt as a clean VIEW intent with only data,
package and the BROWSABLE category.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndows and Linux

The desktop CEF engine replays non-pop-up opens with an http(s) URL as a
selected tab in the source tab's partition, failing closed when that tab
or partition is gone. App links are cancelled in OnBeforeBrowse and
handed to the shell, which confirms with a native dialog naming the
requesting site and the registered app. Schemes Chrome denies are never
handed to the OS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebKit reports only link clicks as activation, so a launch page's
scripted retry button could not ask after the first prompt. macOS and
iOS now record the person's last input; input within 2 s that the page
has not used yet counts once. Input on the prompt itself is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS 0.2.24 (52), iOS 0.2.16 (38), Android 0.2.20 (40), Windows 0.2.17,
Linux 0.2.19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T11:00:00.794339Z 9e17b84 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e17b8448c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/apple/macos/Frameworks Resolved
The ignore rules matched only a directory, so a symlink to a shared CEF
download was committed. Ignore the path whatever it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rafiki270
rafiki270 merged commit 35029e8 into main Nov 23, 2026
11 checks passed
@rafiki270
rafiki270 deleted the fix/popup-external-scheme-and-tab-handoff branch November 23, 2026 11:21
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