Page MenuHomePhabricator

Make generated table of contents a navigation region
Closed, ResolvedPublic

Description

Current:

<div id="toc" class="toc">
  <div id="toctitle">
    <h2>Contents</h2>
    <span class="toctoggle">...</span>
  </div>
  <ul>...</ul>
</div>

A heading and list is pretty good, but I usually see this inside a semantic <nav> or <div role="navigation"> these days, so it can be jumped to as a landmark/region as well. For example, the ToC of the WAI-ARIA recommendation itself. This will be even more useful after T114072 makes sections into regions. Something like this might do the trick:

<div role="navigation" aria-labelledby="tocheading" id="toc" class="toc">
  <div id="toctitle">
    <h2 id="tocheading">Contents</h2>
    <span class="toctoggle">...</span>
  </div>
  <ul>...</ul>
</div>

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 2 2016, 12:40 AM

Change 268363 had a related patch set uploaded (by Matt Fitzpatrick):
Add ARIA "navigation" role and label to table of contents div

https://gerrit.wikimedia.org/r/268363

Danny_B moved this task from Unsorted to ARIA on the Accessibility board.Jul 2 2016, 10:32 PM
stjn added a subscriber: stjn.Apr 23 2019, 5:21 PM

Heydon Pickering specifically suggests it to us in his book Inclusive Design Patterns:

@Volker_E seems like a quick win ?

Absolutely, @TheDJ – I've had no clue there's even a patch already sitting there long – clearly slipped under my radar. Was actively informed by the task of @PerfektesChaos, but haven't had time before my month off in January to closely care about it – thanks for that as well.

Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Pinging the Parsing team.

ssastry added a subscriber: ssastry.Feb 6 2020, 4:12 AM

Pinging the Parsing team.

@Jdforrester-WMF are you asking in the context of Parsoid? Or more broadly? If the former, Parsoid doesn't yet generate TOC. If the latter, let me know.

Change 268363 merged by jenkins-bot:
[mediawiki/core@master] Add ARIA navigation role and label to table of contents div

https://gerrit.wikimedia.org/r/268363

TheDJ closed this task as Resolved.Feb 6 2020, 3:15 PM

Thank you @MattFitzpatrick and @PerfektesChaos
Apologies that it took so long

Pinging the Parsing team.

@Jdforrester-WMF are you asking in the context of Parsoid? Or more broadly? If the former, Parsoid doesn't yet generate TOC. If the latter, let me know.

I was asking if the change was architecturally compatible with Parsoid, or if it's OK to merge… but it was merged before I could clarify. ;-)

Volker_E triaged this task as Medium priority.Feb 6 2020, 6:08 PM
Volker_E added a project: Desktop Improvements.

+1 to what @TheDJ said, thanks @MattFitzpatrick & @PerfektesChaos. Basically majority was in place since 1.28 by @MattFitzpatrick.
Let's settle on better late than never!