czukowski / tab-control-extension

Open tabs to the right, close to the left
https://addons.mozilla.org/firefox/addon/tab-control-addon/
MIT License
2 stars 0 forks source link

interference with 'Switch to tab' functionality #2

Open ronso0 opened 6 years ago

ronso0 commented 6 years ago

Result: it's not noticeable that the target tab was activated because focus switches back to that empty tab you just opened.

First I thought Firefox offers tabs that aren't open anymore, but I noticed it's a bug in this extension when I hit a tab that autoplay sound content.

czukowski commented 6 years ago

Here's what it does for me: the problem is that Firefox closes the tab and activates the 'switch to tab' target. Since the tab that's being closed is active, the extension kicks in and activates the one on the left.

From the extension point of view, there's no indication that 'switch to tab' behavior is in effect or the reason as for why the tab is being closed (the only exception is the browser will indicate whether the whole window is also being closed, which is irrelevant to our case). I'm trying to see whether I'll be able to apply some kind of guesswork to detect that 'switch to tab' was used, but I'm not sure I'll succeed in it.

ronso0 commented 6 years ago

Thanks for having a look!

czukowski commented 6 years ago

@ronso0 I'll have to put this on hold as I cannot see a good way to fix the issue.

When a tab is closed, it is possible to query for the currently active tab, ie the one that was activated after the previous one was closed. Usually it would be one to the right as per default behavior (unless it's the last one) and then a tab to the left should be activated. In case of Switch to Tab feature, it may be any other tab and that tab should be left active. But if Switch to Tab target happens to be the one to the right, the extension couldn't tell what to do as both options are possible. I'm more inclined to leave it as is rather than settling with half-working solutions, so for now I've updated the AMO page to reflect the list of the known issues. I hope it will be possible to fix in the future.