== User Story
As a reader, I want to be able to see a shorter version of the ToC so that I can scan it more quickly
== Design Spec
| {F34939873, width=200} | {F34939871, width=210}
| collapsed state | expanded state
- When a section is **collapsed**, all of its subsections are hidden.
- When a section is **expanded**, all of its subsections are visible.
- Collapsing/expanding behaviour only applies to top-level sections.
=== UI Behaviour
**When clicking on a ToC section link:**
- It should "activate" (scroll to corresponding section and bolden the text)
- The corresponding ToC section should expand
- All other sections should collapse.
=== Default states
NOTE: Although the current design suggests the ToC should be collapsed by default, the implementation should accommodate "expanded by default" in the future (possibly as a user preference).
- **Collapsed by default:** Sections should expand on scroll and click
- **Expanded by default** (potentially in the future):-sections should remain expanded when scrolling and clicking. No collapsing should occur.
== Prototype
https://di-toc-phase2.web.app/Moon
=== A11Y & I18N considerations
- The arrow should point left for RTL languages when collapsed (◀) and be aligned with the beginning of the text.
- This feature (expanding and collapsing) should be disabled for users with the `prefers-reduced-motion` flag enabled in their browser. With this flag enabled, the ToC should essentially fall back to the no-js version.
**no-js version**
Given that this expanding and collapsing on scroll requires Javascript to detect the page position, this feature should be limited to browsers with JS enabled. If javascript is disabled, the table of contents should just be expanded by default and the arrows should not appear.
{F34933232, width=210}
== Acceptance Criteria
[] Sections will have the ability to collapse and uncollapse the subsections within them
[] Collapsing and uncollapsing will be achieved by selecting the section name
[] Sections will be collapsed by default
[] [] A unit test should be added to Vector modelling the behaviour