Title: A target="_blank" link in a preview tab replaces the page instead of opening a new tab
Reproduction
- Serve any page with
<a href="https://github.com/" target="_blank">x</a>.
- Open it in a T3 Code preview tab (observed on
T3Code(Nightly)/0.0.43-nightly.20260925.2251, Electron, Chrome 152).
- 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.
Title: A
target="_blank"link in a preview tab replaces the page instead of opening a new tabReproduction
<a href="https://github.com/" target="_blank">x</a>.T3Code(Nightly)/0.0.43-nightly.20260925.2251, Electron, Chrome 152).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 returnsnulland 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 onmainat4293433ecc):Manager.ts:2053acts on"navigate"by callingwc.loadURL(details.url)on the same previewwebContentsand returning{ action: "deny" }.This path predates #8435, which added the OAuth popup case for
new-windowand left the load-in-place behavior for everything else, including an explicittarget="_blank"request.Fix
PR incoming:
previewWindowOpenActionreturns a third"new-tab"result for aforeground-tab/background-tabdisposition with anhttp(s)URL, and the link opens as a new preview tab instead of navigating the original.