Problem/Motivation
The TOC rendering happens in client-side JavaScript that determines what items should be included in the TOC or hides the TOC if it is empty. However, if JavaScript is disabled, the TOC title is still shown. If the title is displayed in a heading, it can create an inaccurate document outline when JavaScript is disabled.
Steps to reproduce
1. Configure the TOC so it is displayed on a page.
2. Disable JavaScript in the browser and refresh the page. The TOC title will be displayed with no TOC items.
Proposed resolution
Use CSS to make the TOC title hidden by default. Use JavaScript to unhide the TOC when it should be shown.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork toc_js-3568032
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 #4
mably commented@richarddavies, does the latest MR version fix your issue?
If yes, I’ll merge it.
Comment #5
richarddavies commentedYes, the latest MR version is working for me and hides the TOC when JS is disabled.
Comment #7
mably commented