select-after-closing-current icon indicating copy to clipboard operation
select-after-closing-current copied to clipboard

Sometimes, my Firefox jumps to an incorrect right tab, instead of the left tab.

Open camartinez1229 opened this issue 4 years ago • 16 comments

I'm using Firefox 74 on Windows 10. I've been observing this buggy behavior since Firefox 73, however. Before I go further, here's my current config in the addon:

  1. Left -- Unread sibling tab (w/ skip unloaded checked)
  2. Parent tab
  3. Left -- tab (w/ skip unloaded)
  4. Last accessed tab
  5. Right - unread sibling tab (w/ skip unloaded)
  6. Left - pinned tab
  7. Right - child tab (w/ skip unloaded)

I have YouTube as my only pinned tab currently. Going through my subscriptions feed, I'll Ctrl-click on videos I want to watch (to open them in a new tab--I have browser.tabs.loadInBackground as false and browser.tabs.loadDivertedInBackground as true in order to give me the Ctrl-click and Ctrl-Shift-click behavior I want with opening tabs). I'd say about 50% of the time, when I Ctrl+W to close a video tab, the tab that activates afterward is an unrelated tab, far away on the right (like 10-20 tabs or more away), that I'd already read long ago. Interestingly, I usually see the immediate left tab activate for a split second, before it switches to an unrelated right tab that I didn't want.

Occasionally it works correctly. Apparently, though, the only way for me to force it to work consistently is for me to unload all other tabs. Then, video tabs that I close will properly return to my pinned Youtube tab.

I installed Select After Closing Current several months ago, when after rebuilding my profile from scratch, I noticed my tab closing behavior became a lot more annoying than it used to be. This addon helped me a lot. However, in the last several weeks (I'm pretty sure it was after updating to Firefox 73), I've been dealing with my above issue. Rebuilding my profile yet again in the past week has not solved anything. Using similar other addons has not helped either. Is there any way to fix this behavior once and for all?

camartinez1229 avatar Mar 27 '20 22:03 camartinez1229

I am noticing it as well. Specificaly, when set to jump to the last accessed tab, it will often jump to a different tab instead.

alexolog avatar May 29 '20 05:05 alexolog

I am also having a problem with the wrong tab being selected under Firefox 77.0.1. My config is: Left tab.

Sometimes the left tab is correctly selected when I close a tab, but often the left tab is briefly selected but than a tab to the right of the closed tab become selected instead (so far I've seen the tab immediately to the right and the second tab to the right). I suspect that Firefox is coming along after the extension selects the correct tab and selecting a the wrong one.

dhull avatar Jun 25 '20 01:06 dhull

@camartinez1229 @alexolog @dhull

I've been testing on Firefox 77, but unfortunately I cannot reproduce the issue yet.

Have you changed ui.prefersReducedMotion and toolkit.cosmeticAnimations.enabled in about:config?

see the immediate left tab activate for a split second, before it switches to an unrelated right tab that I didn't want

the left tab is briefly selected but than a tab to the right of the closed tab become selected instead

The extension works with 2 methods, the classic method that fixes the selection afterward, and the new method that directly changes the target tab on Firefox 65+. It seems that only the classic method fails here.

Please update the extension, set the added option Operating mode to v4, and see what happens.

jingyu9575 avatar Jun 29 '20 08:06 jingyu9575

Thanks for the comment and the update. I just installed the update, set the v4 mode, and will see how it behaves today. As for the about:config settings, I do have toolkit.cosmeticAnimations.enabled set to false, but the other one does not show up for me. Does the animations one affect the addon in any way?

camartinez1229 avatar Jun 29 '20 12:06 camartinez1229

@camartinez1229 When a tab is closing, it will still exist in the Firefox code briefly if the tab animation is enabled. Otherwise, it is immediately removed in the browser.

Previously, the tab animation feature is controlled by toolkit.cosmeticAnimations.enabled, but in Firefox 77 it is separated into ui.prefersReducedMotion (1 to disable), so the animation may be re-enabled inadvertently in 77. Since there are not many other changes in the browser, I suspect the animation is related to the bug.

jingyu9575 avatar Jun 29 '20 13:06 jingyu9575

I don't see either of these preferences in about:config so I assume they are set to default. Does the extension only work reliably with the animation disabled?

I have changed the preference to v4. Will see how it works.

On an unrelated note, none of the drop-down boxes on the preference page work. When I click on the down-arrow, nothing happens. I am still able to change the preferences using the arrow keys.

alexolog avatar Jun 29 '20 15:06 alexolog

Does the extension only work reliably with the animation disabled?

It was designed to work regardless of the animation, but it seems that there are some bugs now. I'll enable the animations on my browser and try to reproduce it.

none of the drop-down boxes on the preference page work

This should be a problem of Firefox; such drop-down does not work in other extensions either. Looks like it is already fixed in Nightly.

jingyu9575 avatar Jun 30 '20 06:06 jingyu9575

This should be a problem of Firefox;

I have about 40 extensions installed, and this is the only one that I noticed the problem with. Does it do anything differently?

such drop-down does not work in other extensions either. Looks like it is already fixed in Nightly.

Good to know. I'm on dev, so it should propagate soon.

alexolog avatar Jun 30 '20 14:06 alexolog

Thank you for looking into this problem. I decided to look into the issue a bit more on my end, so I disabled all my other extensions to see if "Select After Closing Current" would work reliably for me. And it did! So then I reenabled the extensions one by one and found that the conflict seems to be with "UnloadTabs" (https://addons.mozilla.org/en-US/firefox/addon/unload-tabs/). With that extension enabled this extension works less than half of the time, but with it disabled this extension works all of the time. The operating mode being "mixed" or "v4" does not seem to make a difference.

Here is a list of preferences in "browser.tabs" that I have changed from the default:

browser.tabs.drawInTitlebar: false
browser.tabs.insertAfterCurrent: true
browser.tabs.loadBookmarksInTabs: true
browser.tabs.loadInBackground: false

dhull avatar Jun 30 '20 15:06 dhull

Interesting. I use UnloadTabs too, and I just realized that it has its own options that can affect tab closing behavior. I don't know if those options have always been there, or were added in some update. Regardless, as a test, I've disabled UnloadTabs, and will see how that affects my experience today.

camartinez1229 avatar Jun 30 '20 16:06 camartinez1229

I've tested again with UnloadTabs installed, and checked its code. So far I've found:

  • The conflicting option is prevent Firefox from loading unloaded Tabs. With this option on, my extension becomes extremely unreliable.
  • On Firefox 77, sometimes when the active tab is closed, UnloadTabs believes the decision of my extension is wrong, and tries to override it. However, it won't do that on Firefox 68 ESR.
  • The reason is the event ordering. UnloadTabs sees events in different orders on 77 and 68. These are in the extension logs when only UnloadTabs is installed: 77: 图片 68: 图片
  • I think the event ordering hasn't changed in Firefox, but this setTimeout code causes the ordering to be unstable, and behaves differently on 77 and 68.

@dhull @camartinez1229 I suggest disabling the conflicting option in UnloadTabs. I think it would be difficult to fix the conflict without collaboration with UnloadTabs's developer.


@alexolog Are you also using UnloadTabs?

I have about 40 extensions installed, and this is the only one that I noticed the problem with. Does it do anything differently?

The drop-down bug also happens on Tree Style Tabs. Nevertheless, it has been fixed on today's Firefox release and developer edition.

jingyu9575 avatar Jul 01 '20 07:07 jingyu9575

After a few days of using Firefox with the UnloadTabs extension disabled, I've had no issues with Select After Closing Current, and the new updates have been working well too. I think my issue is resolved. @dhull Thank you for mentioning UnloadTabs. I likely would've never guessed that to be in conflict with this addon. After disabling UnloadTabs, I realized I don't really have a need for it anymore.

camartinez1229 avatar Jul 06 '20 15:07 camartinez1229

Opened https://github.com/NiklasGollenstede/unload-tabs/issues/36 Please comment there with more technical explanation.

alexolog avatar Jul 06 '20 15:07 alexolog

Does anyone know any addon or combination of addons that would let me to

  1. Unload a tab via context menu
  2. Select last accessed tab that is not unloaded after closing current tab

I tried using Select After Closing Current and Unload Tab. Despite toggling Skip unloaded I still get switched to the unloaded tab on the right which is very frustrating.

reallyuniquename avatar Jul 27 '22 16:07 reallyuniquename

@reallyuniquename You might need to checkout the code for one of the two projects and combine the behavior into a custom extension.

diamondman avatar Jan 09 '23 11:01 diamondman

There is no need for another extension. This behavior is already supported by Skip unloaded toggle, it's just bugged.

reallyuniquename avatar Jan 11 '23 11:01 reallyuniquename