autonome / alwaysright

Browser extension that always opens new tabs immediately to the right of the active tab.
https://addons.mozilla.org/en-us/firefox/addon/always-right/
28 stars 5 forks source link

[Chrome] Opening a link from bookmarks toolbar, after not opening a new tab for a while, opens the link at the end #34

Open PuppetMaster000 opened 6 months ago

PuppetMaster000 commented 6 months ago

Hoping the extension is still supported. Starting from about 2 months ago roughly, I believe the new Chrome update broke the extension. Whenever I would open a new link from the bookmarks toolbar (using the middle mouse button) but ONLY after not opening anything for about a minute, the first new tab would always go all the way right. Then on the second click, it would go back to normal and open to the right.

It only happens when no new tabs have been opened for a minute, easiest way to test is just to not touch anything, leave the browser running, then after a minute use the scroll wheel (middle mouse button) to open a new link from the bookmarks toolbar. It opens all the way on the right, but then you can click the exact same link again and it would open to the right as it is suppose to.

The weird part is, you can then keep opening links from the toolbar normally for about 30 seconds, but the moment you don't touch the browser for a minute, it is like the extension "goes to sleep" and needs to wake up again. I should also mention this only happens with the bookmarks toolbar, normal links from a site seem to act as they should.

autonome commented 6 months ago

Hi, thanks for filing!

I can reproduce this in latest Chrome by emulating middle mouse button via cmd+click on a bookmark on the bookmarks bar.

Confirmed that a little wait is required to reproduce.

I'll take a look and see what's happening.

PuppetMaster000 commented 6 months ago

I can't believe I waited this long to report it just because I thought it would never be seen... You are awesome, thank you!

autonome commented 6 months ago

A bit more testing, and this appears to be about tabs.onCreated not firing after a minimum of 25 seconds of delay.

And confirmed that you can reproduce just by cmd+t to open a new tab. The bookmarks bar and middle-click are not relevant. Appears not to matter what the source of the event is.

PuppetMaster000 commented 6 months ago

Thanks for looking into it so quickly. Yeah, that sounds about right. I personally only use the middle mouse button (scroll wheel) to open tabs, which is why I referenced it, but I was sure it applied to other ways too. I just wasn't familiar with all of them. In any case, do you believe this is something that can be fixed? And if so, is it something we should do from user side or should we just wait for the update?

autonome commented 6 months ago

Ok I confirmed with a minimal extension in a clean profile that it is likely not solely related to tab events, and could be a bug in the extension.

Extension code:

chrome.tabs.onCreated(() => console.log('πŸ€ͺ'));

Fires immediately upon opening a new tab, even after the 25s delay.

PuppetMaster000 commented 6 months ago

I suppose that is good news, better if it is in the extension than Chrome itself right? I would assume the extension is easier to control compared to the browser, so hopefully it can be fixed.

autonome commented 6 months ago

Yes and no.

I'm experiencing the observer/observed problem at the moment πŸ˜‚

https://bsky.app/profile/burrito.space/post/3kqpght7j7c2y

On Tue, Apr 23, 2024, at 03:02, PuppetMaster000 wrote:

I suppose that is good news, better if it is in the extension than Chrome itself right? I would assume the extension is easier to control compared to the browser, so hopefully it can be fixed.

β€” Reply to this email directly, view it on GitHub https://github.com/autonome/alwaysright/issues/34#issuecomment-2071208888, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMHN7W72EV6HJKXRKWTZTY6WXJTAVCNFSM6AAAAABGRPZJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZRGIYDQOBYHA. You are receiving this because you commented.Message ID: @.***>

autonome commented 6 months ago

This is likely the Chromium bug: https://issues.chromium.org/issues/40805401

I'm testing a workaround: https://stackoverflow.com/a/66618269/4096929

autonome commented 6 months ago

Ok looks like it's working so far.

I'll ship an update so you can try.

autonome commented 6 months ago

Hrm, nope. Just tested opening external link after 25s delay and still opened at end.

PuppetMaster000 commented 6 months ago

Damn, this bug seems so simple at first, but seems like a nightmare to figure out actually. Thank you for the hard work, hope you can find a fix.

autonome commented 6 months ago

I might just ship with this attempted mitigation and call it a day, hope it happens at least a bit less.

This is clearly a bug in Chrome's implementation of mv3 extensions... which they do not consider a bug.

All the other workarounds add both complexity and unnecessary resource consumption, and put the extension at risk of getting flagged and booted.

On Wed, Apr 24, 2024, at 07:47, PuppetMaster000 wrote:

Damn, this bug seems so simple at first, but seems like a nightmare to figure out actually. Thank you for the hard work, hope you can find a fix.

β€” Reply to this email directly, view it on GitHub https://github.com/autonome/alwaysright/issues/34#issuecomment-2074086355, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMHN5CJHN6QSWINCJNYUTY65BOZAVCNFSM6AAAAABGRPZJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZUGA4DMMZVGU. You are receiving this because you commented.Message ID: @.***>

PuppetMaster000 commented 6 months ago

I checked out the extension called "Open Tabs Next to Current" from the Chrome store, which seems to not have the issue, but it acts differently when opening multiple tabs. I much preferred yours because when opening more tabs from the current tab location, it would open to the right in order clicked (current tab, 1st, 2nd, 3rd clicked), but their extension always opens everything to the right of the current tab you are on only (current, 3rd, 2nd, 1st clicked) if that makes any sense. Any tab opened is forced exactly to the right of the current one. I am only mentioning this if you wish to (although not sure if you can even) check that extension out and see why that one doesn't have the 25s delay thing. Here is a direct link to it in Chrome store: https://chromewebstore.google.com/detail/open-tabs-next-to-current/gmpnnmonpnnmnhpdldahlekfofigiffh

Again, sorry if what I am saying is ignorant, I have no idea how any of this works, just sharing what I have noticed.

autonome commented 6 months ago

Super helpful, thanks! I'll if the source is available, see what they're doing differently.

On Wed, Apr 24, 2024, at 12:01, PuppetMaster000 wrote:

I checked out the extension called "Open Tabs Next to Current" from the Chrome store, which seems to not have the issue, but it acts differently when opening multiple tabs. I much preferred yours because when opening more tabs from the current tab location, it would open to the right in order clicked (current tab, 1st, 2nd, 3rd clicked), but their extension always opens everything to the right of the current tab you are on only (current, 3rd, 2nd, 1st clicked) if that makes any sense. Any tab opened is forced exactly to the right of the current one. I am only mentioning this if you wish to (although not sure if you can even) check that extension out and see why that one doesn't have the 25s delay thing. Here is a direct link to it in Chrome store: https://chromewebstore.google.com/detail/open-tabs-next-to-current/gmpnnmonpnnmnhpdldahlekfofigiffh

Again, sorry if what I am saying is ignorant, I have no idea how any of this works, just sharing what I have noticed.

β€” Reply to this email directly, view it on GitHub https://github.com/autonome/alwaysright/issues/34#issuecomment-2074576004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMHN2CQ2XHHYGMQGXIWKLY657HDAVCNFSM6AAAAABGRPZJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZUGU3TMMBQGQ. You are receiving this because you commented.Message ID: @.***>

autonome commented 6 months ago

Hrm, it's mv2, that's why it's not having the serviceworker problem.

PuppetMaster000 commented 6 months ago

Glad I could help ^^ Sorry I don't know what mv2 and mv3 means 😒 Is it not possible to make yours mv2 as well without issues?

autonome commented 6 months ago

It's the manifest version - and is basically like "major versions" of the browser extension framework itself.

Google developed and pushed manifest v3, and is no longer accepting v2 extensions in the store. But it turns out their own implementation of v3 is basically a bug-infested horror show.

But now that we're having this conversation, I can't remember if the version in the Chrome store is the v3 migration or not...

If it is, there's no way to go back.

If it's not, then I've been chasing the bug in the wrong codebase. Which isn't a loss - I know now that mv3 will have this problem until the Chrome bug is fixed.

I'll check the source of the store version, see what's what.

autonome commented 6 months ago

Hrm, looks like v2.0.0 in the store is the mv3 version.

I'm sorry, but unfortunately I think we'll just have to wait until Chrome fixes the underlying issue. I can't put any more time into working around the fact that they shipped broken stuff.

Maybe try switching to Firefox, where they implemented Chrome's own extensions API correctly πŸ˜…

PuppetMaster000 commented 6 months ago

I see, thank you for clarifying! I actually use both Chrome and Firefox haha, got the extension on both. Shame, I appreciate the effort. I understand its not reasonable to keep trying to work on this if it is mostly on Chrome. I guess if you can, report it to whoever or wherever Chrome gets info on bugs and hope for the best. I will wait for your update to come out and can report if it made things better at least. Until then, I suppose I will stick with that alternative extension. Maybe shoot them a message and see if they are able to make it closer to yours in behavior haha.

Again, thanks for all the effort these past few days!

autonome commented 6 months ago

No worries, thanks for reporting it.

I did some more testing, but this time against Chrome 124 (stable) vs Chrome 126 (nightly), and in early results appears that the workaround does reduce or completely remove incidence of the issue. I can't reproduce it at all when the workaround is in place (so far). I can reproduce 100% of the time without the workaround.

So I'll ship an updated version w/ the workaround and hopefully the problem is resolved by the time 126 hits stable channel. Or maybe sooner - I didn't test 125.

PuppetMaster000 commented 6 months ago

At least there is some hope then haha. Looking forward to it! Let me know when the update is live, I can help report back if I notice anything with the new version.

autonome commented 6 months ago

submitted to chrome store for review

PuppetMaster000 commented 6 months ago

Hey just wanted to add that there is unfortunately another issue after the update. The original issue where it would jump is no longer there, but now, when reopening the browser on Chrome, it takes the tab that is furthest on the right and moves it next to the one you were on it seems. So after opening the browser a few times, it would move several tabs around and mess things up. It would go from: 1,2,3,4,5 to 1,5,2,3,4 then when you open another time 1,4,5,2,3 and so on. I am not 100% certain this is the exact explanation of the issue, but in any case, tabs from the end are definitively moving.

autonome commented 6 months ago

Can you file a new issue? Please include whether it's consistent, or sporadic.

On Fri, May 10, 2024, at 18:10, PuppetMaster000 wrote:

Hey just wanted to add that there is unfortunately another issue after the update. The original issue where it would jump is no longer there, but now, when reopening the browser on Chrome, it takes the tab that is furthest on the right and moves it next to the one you were on it seems. So after opening the browser a few times, it would move several tabs around and mess things up. It would go from: 1,2,3,4,5 to 1,5,2,3,4 then when you open another time 1,4,5,2,3 and so on. I am not 100% certain this is the exact explanation of the issue, but in any case, tabs from the end are definitively moving.

β€” Reply to this email directly, view it on GitHub https://github.com/autonome/alwaysright/issues/34#issuecomment-2104869539, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMHNYIX3P2RWMAH7JJ2I3ZBTWQLAVCNFSM6AAAAABGRPZJICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUHA3DSNJTHE. You are receiving this because you commented.Message ID: @.***>