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

Command icon 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

richarddavies created an issue. See original summary.

mably made their first commit to this issue’s fork.

mably’s picture

Status: Active » Needs review

@richarddavies, does the latest MR version fix your issue?

If yes, I’ll merge it.

richarddavies’s picture

Yes, the latest MR version is working for me and hides the TOC when JS is disabled.

mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.