Page MenuHomePhabricator

[Semantic HTML] Move the sidebar elements' locations in the DOM under the page title
Closed, DeclinedPublic

Description

Background

In legacy Vector the TOC was located after the page title as part of the page content. This location was ideal for a few reasons, the TOC should be located inside the main element as it contains content specific to the page, and the TOC should follow the h1 for easy access for navigating the rest of the page. Legacy Vector's TOC is even frequently used as an example in accessibility guidance (i.e. inclusive components)

Due to the design of the TOC in modern Vector and limitations with Vector's layout CSS, the TOC was moved before the main element. The new DOM location means that keyboard/screenreader users who arrive at the page title (i.e. using the skip link, the main landmark, or h1) will skip over the TOC. It also resulted in other tradeoffs, like the replacement of the "Contents" h2 with a p element and the removal of h3s from the main menu to preserve the heading order (as mentioned in T311294). From a technical perspective, these semantic issues could mean Vector is more prone to other issues in the future, as there isn't a sensible source order to fallback on.

However, with the introduction of CSS grid to Vector, it should be possible to restore the original source ordering, and move the entire sidebar (including the TOC and main menu) after the page title (after article tools would probably make most sense). This would improve the UX of screenreader/keyboard users to be on par with legacy Vector and help future proof Vector from similar issues in the future.

Note

A downside to this is that there will be more elements between the h1 and the rest of the article content. My perspective is that this is to a certain extent unavoidable considering modern Vector's design, which moves several menus to be visually below the h1. It's a bit of a tradeoff between a good source order and some expected verbosity, and this will probably be addressed by T312818. Perhaps we could research how much of an issue this poses for users in the future

AC

  • No visual changes
  • TOC and main menu are located in the DOM after article tools. New tab order should reflect this.
  • TOC "Contents" title should be a h2 element

Event Timeline

Volker_E subscribed.

Sounds well-thought out and reasonable to me from task description. I'd probably make this, as widely impactful change, a topic for review by our contractor AFB.

bwang renamed this task from Move the sidebar elements' locations in the DOM under the page title to [HTML Semantics] Move the sidebar elements' locations in the DOM under the page title.Sep 16 2022, 4:38 PM
bwang updated the task description. (Show Details)
bwang renamed this task from [HTML Semantics] Move the sidebar elements' locations in the DOM under the page title to [Semantic HTML] Move the sidebar elements' locations in the DOM under the page title.Sep 16 2022, 5:45 PM

After doing some more research it may not be necessary for the TOC to be under the h1. W3's ARIA authoring practices site also has a TOC that is outside of the <main> element and before the h1.

I can leave this task open so that we can confirm this conclusion with the AFB testing results, but for the time being I'm moving it to the backlog and lowering the priority

bwang lowered the priority of this task from Medium to Lowest.Oct 10 2022, 9:12 PM

[[ T323634 | AFB validated TOC ]]doesn't have to be in the main landmark or under the h1