Background
Currently the collapsed TOC in the header and floating icon cases rely only on CSS. This is because the collapsing behavior on narrow viewports must work for no JS users (T307900).
In order to improve the screenreader experience for the collapsed TOC (T313447 & T314176), we can use JS to move the ToC in the DOM to the header, similar to the approach taken with the sticky header.
AC
- No visual changes
- The ToC is immediately accessible from the collapsed ToC button and is next to it in the DOM
- Collapsed ToC behaves like all the other dropdowns, (i.e. can be opened via Enter or Space)
- The existing no-js solution is preserved for no-js users below tablet viewports (i.e. the ToC automatically collapses into the page title)
[] When the TOC is collapsed (not into the sticky header) the TOC landmark is in the page header and includes the TOC button and TOC menu
Testing steps
- When JS is disabled, The TOC should work as it does in production across all viewports
Each of the following cases should pass the 2nd and 3rd AC above
- When JS is enabled, test the TOC when collapsed into the page title above tablet viewports by pressing "hide".
- When JS is enabled, test the TOC when collapsed automatically into the page title below tablet viewports.
- When JS is enabled, test the TOC when collapsed into the sticky header by pressing "hide" when the sticky header is visible.
QA Results - Beta
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T318013#8476735 |
| 2 | ✅ | T318013#8476735 |
| 3 | ✅ | T318013#8476735 |
| 4 | ✅ | T318013#8476735 |
| 5 | ✅ | T318013#8476735 |
QA Results - Prod
| AC | Status | Details |
|---|---|---|
| 1 | ⬜ | T318013#8476757 |
| 2 | ✅ | T318013#8476757 |
| 3 | ✅ | T318013#8476757 |
| 4 | ✅ | T318013#8476757 |
| 5 | ✅ | T318013#8476757 |








