Skip to content

Long text scrolling jitter #140

Description

@Some14u

There is an issue with scroll behavior in your implementation.
If you quickly scroll a long text with the mouse wheel, it awkwardly glitches with a setback jittering. Tried both chrome and ff.

I investigated this and prepared a patch for the scroll jitter.

Repro steps

  1. Open AceDiff with long content on both sides.
  2. Enable scroll sync (lockScrolling: true).
  3. Quickly scroll with mouse wheel in either pane.
  4. Observe occasional backward/setback jumps (jitter).

Expected

Smooth synchronized scrolling without rollback/jumps.

Actual

When scrolling fast, panes sometimes "fight" each other and produce setback jitter.

Suspected cause

Both panes have independent throttled changeScrollTop handlers.
Under fast wheel input, delayed/throttled callbacks can execute out of order and compete.

Proposed fix

Use one centralized scroll scheduler:

  • keep lastScrollSource
  • cancel pending frame
  • sync once per requestAnimationFrame
    This removes throttle competition between left/right handlers.

I attached a patch file:
issue-140-scroll-jitter.patch
(contains changes in src/index.ts)

issue-140-scroll-jitter.patch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions