Problem/Motivation
The level-2 menu toggle currently uses aria-controls to associate with the menu it toggles. Screenreader support for aria-controls is very limited and there are more appropriate options. As detailed in this article about menu button accessibility
In this case, using aria-haspopup="true" can be used in its place. This will inform assistive tech that it opens a menu pop-up. More info on this aria usage can be found in this flyout menus spec
This issue has some overlap with #3190140: Collapsible nav button text should be more descriptive and it's probably worth reviewing that as part of getting acquainted with this one.
Comments
Comment #2
bnjmnmComment #3
bnjmnmComment #4
andrewmacpherson commentedNo, the proposal is completely wrong. It doesn't conform to the W3C ARIA recommendation. Don't make either of these changes.
The menu has been built from simple disclosure buttons. We're following the Link + Disclosure Widget Navigation pattern very closely. That's a robust pattern, with minimal moving parts.
Regarding
aria-controls:It's true that
aria-controlsisn't widely supported by assistive technology yet. To date, I think JAWS is the only assistive technology which does anything with it. Note, in the Heydon Pickering Menus and Menu buttons article cited, he doesn't actually recommend removing it.Nonetheless, it works. JAWS provides an indication that the button controls other content, and provides a mechanism to jump to the related content.
A common complaint about the jump mechanism announcement in JAWS is that it doesn't provide much benefit when the controlled content appears directly after the button (as in our case). However JAWS has addressed this by making the announcement obey a user preference. IIRC, it is disabled by default in new JAWS installations.
In assisitive technology which doesn't yet support it, it is just ignored.
In the section about
aria-expanded, the ARIA recommendation says: "If the element with thearia-expandedattribute controls the expansion of another grouping container that is not 'owned by' the element, the author SHOULD reference the container by using thearia-controlsattribute." Our usage matches this, so we should include the machine-readable relationship.Upshot: keep the
aria-controlsrelationship. It follows the spec, and I don't see a strong case for removing it.Regarding
aria-haspopup:Beware of conflating these:
aria-haspopupis NOT an alternative toaria-controls. They serve different purposes, and I can imagine uncommon situations which warrant both.In the W3C fly-out menus tutorial cited,
aria-haspopupis used in a way which does NOT conform to the ARIA 1.1 recommendation:The example in the W3C fly-out menus tutorial doesn't control any of these roles.
Olivero's disclosure buttons don't control any of these roles either, so we shouldn't use it. Using
aria-haspopup="true"would falsely convey that the list of links behaves as an application menu. We'd be lying to the screen reader!Aside: the ARIA 1.0 recommendation was rather vague about the meaning of "menu". It wasn't clear whether it meant the ARIA role, or just used the word in a general sense. I expect the W3C tutorial dates from that period. Rather than follow the advice in that tutorial, we ought to file a bug report against it.
Upshot: we shouldn't add the
aria-haspopupattribute.Comment #5
andrewmacpherson commentedBut the problem is that the button DOESN'T reveal menu items. It reveals hyperlinks. This isn't an application menu.
You don't actually need
aria-haspopupto convey that additional content will be revealed. The present use ofaria-expandedconveys that.