Skip to content

Drawer(TOC): 現在位置を自動スクロール#181

Merged
ootakazuhiko merged 3 commits into
mainfrom
fix/drawer-active-toc-scroll
Feb 17, 2026
Merged

Drawer(TOC): 現在位置を自動スクロール#181
ootakazuhiko merged 3 commits into
mainfrom
fix/drawer-active-toc-scroll

Conversation

@ootakazuhiko

Copy link
Copy Markdown
Collaborator

Refs:

変更内容

  • モバイルで Drawer(TOC)を開いた直後に、現在位置の TOC(a.toc-link.active)が可視領域外の場合は scrollIntoView で中央付近に移動します。
  • 既に可視領域内ならスクロールしません。

目的

  • Drawer を開いた直後に「現在位置」が見えず手動スクロールが必要になるケースを解消します。

Copilot AI review requested due to automatic review settings February 17, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds auto-scroll functionality to the table of contents (TOC) drawer on mobile devices. When the drawer is opened, if the currently active TOC item is outside the visible viewport, it will automatically scroll into view at center position. This eliminates the need for manual scrolling to find the current position in the TOC.

Changes:

  • Added JavaScript functionality to detect when mobile TOC drawer is opened
  • Implemented smart scrolling that only triggers when active TOC item is outside viewport
  • Uses path normalization to accurately match the current page with TOC links

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ootakazuhiko
ootakazuhiko merged commit d9fdb1c into main Feb 17, 2026
3 checks passed
@ootakazuhiko
ootakazuhiko deleted the fix/drawer-active-toc-scroll branch February 17, 2026 05:55
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.

2 participants