mediawiki-skins-Vector/includes/templates/TableOfContents.mustache
Jan Drewniak 7d32ec80d3 Collapse ToC by default & expand sections when clicking section headings
Collapses sub-sections in the new table of contents by default
(except for non-js and reduced-motion users) and expands the
sections when the top-level section link has been clicked.

Refactors the `activateSection` TableOfContents methods into separate
`activateSection` and `deactivateSection` functions.
Adds `expandSection` and `collapseSection` methods.

Adds triangle icon as a visual expand/collapsed indicator
next to all ToC section headings and are hidden via CSS based on
whether or not the section contains subsections.

Adds test for tableOfContents.

Bug: T299361
Change-Id: I36b3ae7f9f633877683bc17a9444c970d7fa7293
2022-02-15 00:09:50 -05:00

11 lines
328 B
Plaintext

<nav id="mw-panel-toc" class="sidebar-toc" role="navigation" aria-labelledby="sidebar-toc-header">
<div class="sidebar-toc-header">
<h2 class="sidebar-toc-title" aria-hidden="true">Contents</h2>
</div>
<ul id="table-of-contents">
{{#array-sections}}
{{>TableOfContents__topSection}}
{{/array-sections}}
</ul>
</nav>