Skip to content

Keep the Aliki TOC highlight in sync with the scroll position - #1849

Open
st0012 wants to merge 3 commits into
masterfrom
claude/project-thread-jy400m-toc
Open

st0012 wants to merge 3 commits into
masterfrom
claude/project-thread-jy400m-toc

Conversation

@st0012

@st0012 st0012 commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Requested by Stan · project thread

The highlighted item in the right-hand "On This Page" TOC now follows the reader through long method lists. It also follows them after long jumps and after links to a method.

Before, the active item only changed when an IntersectionObserver reported a heading crossing the viewport. Long method lists have no TOC headings for thousands of pixels. So the highlight stayed on an old heading after a long scroll, and nothing was highlighted after opening a method from search or a #method-i-sub link. Now the current heading is computed on scroll. If no heading is in the upper part of the viewport, the last heading above the viewport becomes the current one.

#1842 fixes the TOC nesting of method group headings separately.

The TOC highlight only changed when a heading crossed the viewport, so
it went stale after long jumps and stayed empty when landing on a
method link. Compute the current heading on scroll instead, falling
back to the last heading above the viewport.

Constants, Attributes and method group headings in the untitled section
are now listed at the same TOC level as the class comment's sections,
instead of nesting under its last heading.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gxq9jGyjWoANhMZXRtssiu
@st0012 st0012 self-assigned this Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Documentation preview

View the preview

Commit: 8512f01

#1842 fixes the method group nesting by emitting h2 headings in
the default section, so the TOC needs no special case for them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gxq9jGyjWoANhMZXRtssiu
@st0012 st0012 changed the title Fix Aliki TOC highlighting and method group nesting Keep the Aliki TOC highlight in sync with the scroll position Oct 13, 2026
@st0012
st0012 marked this pull request as ready for review October 15, 2026 21:12
Copilot AI balanced review requested due to automatic review settings October 15, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Viewport resizing can leave the highlighted section stale until another scroll occurs.

1 open finding
What changed in this PR

Updates Aliki’s “On This Page” highlighting to follow scroll position through long method lists and direct method links.

Changes:

  • Replaces intersection tracking with frame-scheduled scroll updates.
  • Falls back to the last heading above the viewport.
  • Tracks the active link to avoid redundant updates.
File Description
lib/​rdoc/​generator/​template/​aliki/​js/​aliki.js Computes the active TOC heading from viewport position.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/rdoc/generator/template/aliki/js/aliki.js Outdated
A taller viewport can bring the next heading into the upper part of the
page without a scroll event.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gxq9jGyjWoANhMZXRtssiu
Copilot AI balanced review requested due to automatic review settings October 15, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Source-panel layout changes can leave the TOC highlight stale until the next scroll or window resize.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Refresh section highlight when source panel layout changes

lib/​rdoc/​generator/​template/​aliki/​js/​aliki.js:350

These listeners miss layout changes that happen without scrolling or resizing the window. Collapsing a method's Source panel changes its height and can move the next section heading into the upper 65% of the viewport, but the previous section stays highlighted until another scroll or resize. The removed IntersectionObserver detected that heading entering the activation area. Observe the main content's size as well and reuse scheduleUpdate so source-panel transitions also refresh the highlight.

🧠 Review effort: Balanced

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants