rNeomy / auto-tab-discard

Use native tab discarding method to automatically reduce memory usage of inactive tabs
https://webextension.org/listing/tab-discard.html
Mozilla Public License 2.0
929 stars 79 forks source link

Current scrollbar position is forgotten uppon discard #229

Open Rafagd opened 3 years ago

Rafagd commented 3 years ago

I'm reading the https://thebookofshaders.com/ very slowly, and which mean I'm leaving the tab open in the background for a long enough time that the tab is being discarded, as expected, by ATD. The problem is that once I restore the tab, the scrollbar position resets to the top and I need to scroll down to find where I had last stopped.

Shouldn't discarded tabs remember the scrollbar position?

megamorphg commented 2 years ago

I am having the same issue and also a related issue: selection caret is reset to outside the tab.

Steps to reproduce:

  1. Load a video on Youtube.com, play and scroll down
  2. Discard the tab
  3. Load the video again. Notice the video plays.
  4. Press space to pause. Notice that the video cannot be paused because the selection caret is lost.
  5. Press Tab 4 times. Notice that the selection caret is now within the page and video can be paused.
rNeomy commented 2 years ago

Since the browser is responsible for releasing the discarding state, I am not sure what is the best solution to fix these sorts of problems.

megamorphg commented 2 years ago

Since the browser is responsible for releasing the discarding state, I am not sure what is the best solution to fix these sorts of problems.

Does the normal discarding process that Chrome does do the same thing? I could swear that Chrome's method kept the scroll position and caret.

I am not able to test out the original method since I'm not sure how to reproduce that without uninstalling Tab Discarder and then waiting a day for a tab to be discarded?

rNeomy commented 2 years ago

@megamorphg use chrome://discards/

megamorphg commented 2 years ago

@rNeomy I'm not sure how to have it discard a specific tab to test. When I click "Urgent discard a tab now" it doesn't do anything... Any idea how to replicate a discard action?

rNeomy commented 2 years ago

When on an HTTP page, the "Urgent Discard" button is pressed, the lifecycle status changes to "discarded (urgent)". The tab is now discarded, but there is no visual indication.

megamorphg commented 2 years ago

@rNeomy ah, so it only works for HTTP? I load an HTTP page in the background and then click urgent discard and nothing happens.

Was testing with the extension though and this "scrollbar position lost issue" and it does seem to maintain scrollbar position after a discard on text pages including on the page that @Rafagd mentioned.

On YouTube pages though it for sure happens including resetting the caret position if I do a manual discard. Not sure if I should open a new Issue instead.

rNeomy commented 2 years ago

I load an HTTP page in the background and then click urgent discard and nothing happens.

It works fine for me!

On YouTube pages though it for sure happens including resetting the caret position if I do a manual discard

Since it also happens for manual discarding from chrome://discards, you can report this to the Chrome bugs.