Skip to content
Source
Sign inSign up
pingdotgg/t3code

A target="_blank" link in a preview tab replaces the page instead of opening a new tab #13953

Closedjamesvillarrubia(GitHub profile, opens in a new tab) opened this issue 0 comments

Title: A target="_blank" link in a preview tab replaces the page instead of opening a new tab

Reproduction

  1. Serve any page with <a href="https://github.com/" target="_blank">x</a>.
  2. Open it in a T3 Code preview tab (observed on T3Code(Nightly)/0.0.43-nightly.20260925.2251, Electron, Chrome 152).
  3. Click the link.

Observed: the preview tab's URL becomes https://github.com/...; the original page is gone. Also observed: window.open(url, '_blank', 'noopener') from the page returns null and does the same thing. Expected: the page stays, and the link opens in a new preview tab.

Cause

apps/desktop/src/preview/Manager.ts:559 (same on main at 4293433ecc):

export const previewWindowOpenAction = (details: {
  readonly url: string;
  readonly disposition: Electron.HandlerDetails["disposition"];
}): "popup" | "navigate" =>
  details.disposition === "new-window" && isPopupUrl(details.url) ? "popup" : "navigate";

Manager.ts:2053 acts on "navigate" by calling wc.loadURL(details.url) on the same preview webContents and returning { action: "deny" }.

This path predates #8435, which added the OAuth popup case for new-window and left the load-in-place behavior for everything else, including an explicit target="_blank" request.

Fix

PR incoming: previewWindowOpenAction returns a third "new-tab" result for a foreground-tab/background-tab disposition with an http(s) URL, and the link opens as a new preview tab instead of navigating the original.

  1. juliusmarminge closed this

Sign in to join this conversation.