josh-berry / tab-stash

Firefox extension to save and restore tabs as bookmarks. Clear your tabs, clear your mind.
https://josh-berry.github.io/tab-stash/
Mozilla Public License 2.0
797 stars 45 forks source link

Wrong next tab selected after stashing active tab #369

Closed tokumeiii closed 1 month ago

tokumeiii commented 1 year ago

System Details

Installed Browser Extensions: I tried disabling all extensions except for Tab Stash and the problem persisted.

Describe the Bug

When I stash the active tab by any means I know of to do it (address bar button, toolbar icon, tab context menu, the main Tab Stash sidebar), the tab seven tabs to the right of the stashed tab is selected as the new active tab.

Steps to Reproduce

  1. Stash the active tab.

Expected Behavior

The immediate next tab should be selected as the new active tab as happens when a tab is closed normally.

Impact

When selectively stashing multiple tabs at a time this throws you around all over the place and makes it hard to keep track of what tabs you've looked at already.

Additional Details

I happen to have a Linux VM handy with Firefox 114, and I was unable to reproduce the issue there.


Readers: If you are also experiencing this bug, please vote for it by giving the ORIGINAL POST a thumbs-up using the :smiley: button. You are welcome to leave comments and discuss the issue if you have more details to add, but "Me too!" comments are not counted by the voting system.

josh-berry commented 1 year ago

Hi, sorry for the delay in getting back to you. Given that you're not able to reproduce the issue in a production release of Firefox, and I'm similarly not able to reproduce the issue on my side, my strong suspicion is this is not a problem with Tab Stash at all but instead a bug in Nightly, which is known to be unstable and have lots of weird issues.

If you can reproduce the issue on a production release of Firefox, please do let me know though!

davidcreel commented 1 year ago

@josh-berry Thank you for making this extension! I have observed this behavior fairly regularly with long running windows with lots of tabs. The behavior was present in Tab Stash 2.x and is still present in 3.x.

I have two windows right now with this issue: one with ~400 tabs and another with ~150 tabs. One thing to note is the windows in question have been closed for computer shutdown/firefox update and then re-opened. If I open a new window on the same machine, then the issue is not present in that window but still present in the others. So unfortunately it isn't very easy to reproduce.

When I stash a tab in the window with 400 tabs, it will consistently change the active tab to the one 10 tabs to the right. When I stash a tab in the window with 150 tabs, it will consistently change the active tab to the one 5 tabs to the right. If there are fewer than 5/10 tabs to the right, then it will change the active tab to the right-most tab.

This screencap was with Firefox 118.0.1 on MacOS 14.0 using Tab Stash 3.0.

https://github.com/josh-berry/tab-stash/assets/35275687/9b9e210f-6213-42be-8897-dbb7a6199040

josh-berry commented 1 year ago

@davidcreel Thanks for sharing the video; I agree that's very strange. It's not clear to me without debugging further what's causing it; my current suspicion is Tab Stash is somehow getting confused about where each tab is in the window, either because it's not tracking this correctly or because Firefox is reporting it incorrectly to Tab Stash. I'll have to see if I can reproduce this on my end to get more info about what's going on.

bojidar-bg commented 5 months ago

Not sure if it's the same issue or I should open a new one; for me, whenever I stash a tab, I always get the right-most tab selected. Rather annoying when one has to scroll back 20+ tabs to find where one was :sweat_smile:

davidcreel commented 5 months ago

Sounds similar. The offset by which it jumps for me is not always the same every time. E.g. if it happens one week it will jump 10 tabs to the right on tab close. The next week it will jump 5 tabs to the right on each tab close. I haven't seen 20 though!

I still suspect Firefox itself is the culprit simply because this usually happens when I've had Firefox open for a while and it starts to break in other ways too. I don't know much about the inner workings of Firefox or this extension, but I would love to debug it next time it happens if I could get a few pointers about what to check.

On Sun, Jun 2, 2024 at 12:12 PM Bojidar Marinov @.***> wrote:

Not sure if it's the same issue or I should open a new one; for me, whenever I stash a tab, I always get the right-most tab selected. Rather annoying when one has to scroll back 20+ tabs to find where one was 😅

— Reply to this email directly, view it on GitHub https://github.com/josh-berry/tab-stash/issues/369#issuecomment-2143946801, or unsubscribe https://github.com/notifications/unsubscribe-auth/AINEHJ6UIZBD7P7UR7XAGM3ZFNG7LAVCNFSM6AAAAAAZADVCUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTHE2DMOBQGE . You are receiving this because you were mentioned.Message ID: @.***>

AIG420 commented 2 months ago

I'm having a similar issue. Every time I stash a tab(s) it jumps to the right most tab, no matter how many tabs are in between the stashed tab and the right most one (even 100+).

bojidar-bg commented 1 month ago

Actually, I think I might have a clue. :eyes: When I stash the currently-open tab, the index of the newly-selected tab seems to be off by exactly the sum of pinned and hidden (just-stashed) tabs. Will keep testing that some more, since there might be something else at play too, but that would seem to explain the usual scenario of getting the right-most tab after heavy usage of tab-stash... and it could perhaps even explain the case of different behavior after firefox update/computer shutdown, as firefox might be recreating the hidden tabs then.

josh-berry commented 1 month ago

Thanks, that's useful info. I'll poke at this further and see what I can find.

josh-berry commented 1 month ago

Found the bug, should be fixed in the next release. Noticing that the offset was related to the number of pinned+hidden tabs was the key to finding it. Thanks for reporting and for the help in narrowing it down!

bojidar-bg commented 1 month ago

Amazing news! Thanks for all the hard work! :green_heart: