Problem/Motivation
The ToC links are generated to h2, h3 headings in node body field only.
In case there is a h4 heading in the url the page is scrolling to the h3 heading above it, rather than to that specific h4.
Steps to reproduce
1. Heading structure in node body field:
<div class="chunker-section">
<h2 id="h2-hash">
<p>...</p>
<h3 id="h3-hash">
<p>...</p>
<div class="embedded-entity">
<div id="h4-hash">
<h4>...</h4>2. Check a different hash in the url
* https://example-site.com/test-page#h2-hash OK scrolls to the right h2
* https://example-site.com/test-page#h3-hash OK scrolls to the right h3
* https://example-site.com/test-page#h4-hash scrolls to the top of a section (h2 header) or to the h3 that is above the requested h4.
TODO: It should scroll to the right position and show the correct h4 header.
Proposed resolution
* Make setActive(toc_selector, hash) working not only for h2 and h3 but also for h4
* h4 will require a different hash in node body field (for scrolling) and ToC block in the sidebar to set the closest h3 as an active link.
Remaining tasks
Needs a review
User interface changes
No
API changes
No
Data model changes
No
Issue fork sector_toc-3281000
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rosk0It looks more like a bug report than feature request. Needs works as per review.
Comment #4
tatianag commentedComment #6
rosk0Merged , thanks!