Force Background Tab extension not working under certain conditions
-
Using latest version of Vivaldi but I think this bug has existed for a while now.
Although my title specifics 'Force Background Tab', after some testing I believe this is a bug that affect all extensions that call
chrome.tabs.update(tabid, {active: true});
immediately after tab creation (For example: 'Tab Position Customizer' is not working properly either). These extensions work fine in other browsers.First of all if 'New Tab Position' is set to 'As Last Tab' it works fine but any other setting would trigger the bug (I use 'After Related Tabs')
And here's the weird thing - if there's no unrelated tab after current active tab then it continues to work as expected.
But as soons as I move the tab so there's an unrelated tab after it, the extension stop working as the gif below demonstrated:
Here's a url for test (Use Left-click on 'Try it Yourself »'. Middle-click and Ctrl-click are irrelevant to this bug)
https://www.w3schools.com/jsref/met_win_open.aspAlso after some tinkering I found out that one workaround is to use serTimeout to delay a chrome.tabs.update call like
setTimeout( function(){ chrome.tabs.update(last_tabid, {active: true}); }, 100);
but this is obviously not ideal nor reliable.
One more info:
If you callchrome.tabs.query
after the bug happened in Force Background Tabchrome.tabs.query({active: true}, (tab) => { console.log(tab[0].id); });
it will show wrong tab id (not the active tab's id).