Marks: fix local marks not restoring position in internal scrollable elements#4925
Open
CosmosJ0618 wants to merge 1 commit into
Open
Marks: fix local marks not restoring position in internal scrollable elements#4925CosmosJ0618 wants to merge 1 commit into
CosmosJ0618 wants to merge 1 commit into
Conversation
Fix an issue where local marks fail to jump correctly on modern sites (like Twitter/Reddit) that use internal divs instead of the window for scrolling. Marks now save and restore the scroll position of the inner active element.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Rationale:
Currently, Vimium's local marks (
ma,`a) fail to jump back to the correct scroll position on websites that use an internaldivfor scrolling (which is increasingly common in modern SPAs like Twitter, Reddit, etc.).The bug occurs because
Marksonly saves and restoresglobalThis.scrollXandglobalThis.scrollY, which both remain0when an internal container is scrolled.Changes made:
activeElement()helper inScrollerto expose the currently active scrolling element (ensuring it's still in the DOM).marks.jsto optionally recordlocalScrollXandlocalScrollYalongside the window scroll values.