Skip to content

Fix #38: links open inside the BT standalone window on Vivaldi#45

Open
bennyz327 wants to merge 1 commit into
tconfrey:masterfrom
bennyz327:master
Open

Fix #38: links open inside the BT standalone window on Vivaldi#45
bennyz327 wants to merge 1 commit into
tconfrey:masterfrom
bennyz327:master

Conversation

@bennyz327

Copy link
Copy Markdown

Problem

Reported in #38 (Vivaldi 7.4): when the Topic Manager is run in WINDOW
(standalone panel) mode, clicking any link in the tree opens the
document inside the BT panel window, replacing the BT UI — rather
than in the user's main browser window. Only Vivaldi is affected;
Chrome, Edge behave correctly.

Root cause

background.js's openTabs / openTabGroups call chrome.tabs.create({url})
without a windowId whenever the parent topic has no siblings already open.
Chrome's currentWindow resolution explicitly skips popup / panel /
devtools window types, so on standard Chromium the new tab lands in
the user's most-recently-focused normal window — exactly what we want.

Vivaldi's currentWindow resolution does not exclude its own panel
windows, so the new tab is routed into the BT panel itself.

Fix

A small helper nonBTWindowId() returns the id of a non-BT normal
window to pass to chrome.tabs.create. It is a Vivaldi-only
workaround
— it returns null on every other browser, so their code
paths are byte-identical to before this PR.

Vivaldi detection uses the vivExtData property that Vivaldi attaches
to every Window object (verified absent on Chrome/Edge). This is
robust to Vivaldi's UA-masking setting, which by default makes Vivaldi
indistinguishable from Chrome via navigator.userAgent /
userAgentData.

The helper is also used in openTabGroups so "Open All" / tab-group
restores get the same treatment.

Testing

  • Vivaldi 7.9.3970.64 (Windows 11): WINDOW mode — single-link click and
    "Open All" both open in the user's main browser window; BT panel
    untouched. Sibling-grouping still routes to the sibling's window.
  • Chrome stable: WINDOW / TAB / SIDEPANEL modes — behavior
    unchanged from before this PR (helper returns null, same code path
    as today).
  • TAB mode and SIDEPANEL mode also unchanged on Vivaldi (helper early-returns
    before the Vivaldi probe).

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