internetarchive / internetarchive/bookreader
Scrolling to current chapter in mobile TOC
- 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
Assessment
This issue has not been assessed yet.