internetarchive / internetarchive/bookreader

Scrolling to current chapter in mobile TOC

Open
#374 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
491
Avg merge
2d 15h
Merged PRs (30d)
3

Description

**Context**
We would like the list of the chapters to be scrolled to the current chapter each time the table of contents is opened

**Proposal & Constraints**

The process to find the current chapter when the TOC table is opened is already done. The current chapter element is defined by the class `.current-chapter`. The code to scroll the TOC table to the current chapter should be in the `BookReader.prototype.updateTOCState` function inside `src/js/plugins/plugin.chapters.js`, because it gets called each time the mobile TOC table is opened.
Using something like `.ScrollIntoView()` may not work every time because of conflicts with mmenu. Simpler scrolling methods may cause less unexpected problem.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.