Skip to content

Marks: fix local marks not restoring position in internal scrollable elements#4925

Open
CosmosJ0618 wants to merge 1 commit into
philc:masterfrom
CosmosJ0618:fix-local-marks-spa
Open

Marks: fix local marks not restoring position in internal scrollable elements#4925
CosmosJ0618 wants to merge 1 commit into
philc:masterfrom
CosmosJ0618:fix-local-marks-spa

Conversation

@CosmosJ0618

Copy link
Copy Markdown

Description

Rationale:
Currently, Vimium's local marks (ma, `a) fail to jump back to the correct scroll position on websites that use an internal div for scrolling (which is increasingly common in modern SPAs like Twitter, Reddit, etc.).

The bug occurs because Marks only saves and restores globalThis.scrollX and globalThis.scrollY, which both remain 0 when an internal container is scrolled.

Changes made:

  • Added a simple activeElement() helper in Scroller to expose the currently active scrolling element (ensuring it's still in the DOM).
  • Updated marks.js to optionally record localScrollX and localScrollY alongside the window scroll values.
  • Updated the goto logic to restore the internal container's scroll position if those values exist.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant