Skip to content

[Bug] Annotate: Contents highlight becomes stale after large scrolls and stays stale across files #2231

Closed

Description

@zane668

What happened?

The Contents sidebar can stop following the visible section. Slow scrolling initially works. After large wheel movements the highlighted entry lags several sections behind; switching to another document with the same heading count and scrolling slowly does not recover it.

Reproduction

Generate two synthetic files:

from pathlib import Path
for label in ('a', 'b'):
    Path(f'{label}.md').write_text('\n'.join(
        '#' * (i % 3 + 1) + f' {label.upper()} Section {i+1:02d}\n\n'
        + (('Synthetic public sample paragraph for scrolling verification. ' * 6) + '\n\n') * 9
        for i in range(15)
    ))
  1. Run plannotator annotate a.md b.md, use a 1440×900 viewport, dismiss first-run announcements and open Contents.
  2. Hover the document, wheel down about 140px × 20, waiting 330ms between movements and 500ms at the end. This is the working slow-scroll control.
  3. Click A Section 01, wait 800ms, then wheel down about 1100px × 5 with the same waits.
  4. Switch Files → b → Contents. Wheel down 140px × 45 with the same waits.

Actual vs expected

Observation Current document section Contents entry with aria-current="location"
Initial slow-scroll control A Section 03 A Section 03
After large scrolling A Section 05 A Section 02
Slow scrolling in second file B Section 10 B Section 02

Expected: after scrolling settles, Contents follows the current section, including after switching files.

The two failure observations above are consecutive steps in one fresh 0.28.32 session. Both files have 15 headings; this alone does not establish equal heading count as the root cause. This is a Contents-active-state problem, not the Back-button restoration issue in #2128.

Environment

  • Official Plannotator 0.28.32, Darwin ARM64; macOS 27.0.1, Apple silicon.
  • Fresh headless Chromium 155.0.8059.12, viewport 1440×900.
  • Standalone Annotate CLI, isolated temporary HOME/data, generated English documents only.

Activity

  1. zane668 commented on Oct 29, 2026

    @zane668
    Author

    Retested the original equal-heading-count a.md / b.md fixture on the official v0.28.36 stable binary (macOS Apple silicon, fresh in-memory Chromium 155.0.8059.12, 1440×900, isolated HOME/data directory). Native mouse-wheel input was used, not a synthetic DOM scroll event.

    Both stale-highlight cases still reproduce:

    Step Actual document position Contents aria-current="location"
    Slow-scroll control, 20 × deltaY=140 scrollTop=2800; A Section 03 A Section 03 — correct
    Return via Contents, then 5 × deltaY=1100 scrollTop=4474; A Section 05 A Section 02 — stale
    Switch to b.md (same 15-heading count), then 45 × deltaY=140 scrollTop=10774; B Section 11 heading visible at y=147.546875 B Section 02 — stale

    The actual scrollable main, heading geometry, and Contents state were measured after each gesture settled. The original reproduction and expected behavior still apply; this is not a claim about an untested development branch. No private documents were used.

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