Closed (fixed)
Project:
Olivero
Component:
Proof of Concept
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Oct 2019 at 15:00 UTC
Updated:
24 Nov 2019 at 00:59 UTC
Jump to comment: Most recent
Because we are using aria-expanded on the menu, we don't need aria-pressed on the button. We can get rid of aria-pressed and leave aria-expanded in place. The toggle of the property happens in JS so we should remove this part of code out of the Olivero JS.
Current implementation:
<button class="nav-primary__button" aria-controls="site-header__inner" aria-label="Toggle navigation"
aria-pressed="true">
<span class="nav-primary__icon"></span>
</button>
...
<div id="site-header__inner" class="site-header__inner" aria-expanded="true">
...
</div>
The correct implementation should look like this when the menu is expanded:
<button class="nav-primary__button" aria-controls="site-header__inner" aria-label="Toggle navigation" aria-expanded="true">
<span class="nav-primary__icon"></span>
</button>
...
<div id="site-header__inner" class="site-header__inner">
...
</div>
How it's currently working:

| Comment | File | Size | Author |
|---|---|---|---|
| Oct-28-2019 15-59-25.gif | 3.2 MB | fhaeberle |
Comments
Comment #2
MaddieC commentedComment #3
rachel_norfolkretagging
Comment #4
mherchel@MaddieC Unassigning you, as I don't want to hold up this issue if other people want to work on this. If you have work, please create a PR within the proof of concept repo on github. Also ping me in Drupal Slack (#d9-theme channel) if you need assistance!
Comment #5
waako commentedAgree with removing the
aria-pressed, but shouldn't thearia-expandedbe on the menu toggle button also otherwise there is no feedback to the user on the state of header-menu and the #site-header__inner div is not a focusable element so that provides no feedback as to it's visibility state.For progressive enhancement and resilience, the toggle button should be added, and header-nav hidden, via javascript.
Currently if js issue there is no access to header-menu just a button that does nothing.
Ideally the toggle button should be inside a
navelement and be immediately followed by the menu, as currently for screen-readers when first landing on mobile page and listing landmarks there is only banner and main, so no navigation landmarks at all.I appreciate that with current designs where search sits above menu that won't work so well, even if button was positioned in banner via css, it would break the tabbing order (search would be before toggle button in tab order).
Comment #6
cainaruI concur with what waako stated above regarding placing the menu's toggle button inside of the
navelement in order for the navigation landmark to be detected. This resource might come in handy for whoever gets a chance to tackle https://www.a11ymatters.com/pattern/mobile-nav/FWIW, it looks like the Umami theme encountered similar (https://www.drupal.org/project/drupal/issues/2940023 and https://www.drupal.org/project/drupal/issues/3042417), so perhaps it might also be worth looking towards what has been considered there?
Comment #7
waako commentedAlso noticed that aria attributes are not applied on load, only when menu is toggled.
No doubt a number of items like this will come out of the accessibility review, so might be worth postponing this issue for now?
Like cainaru says, we can leverage the work being done on Umami to get it just right here.
Comment #8
mherchelThanks for the note. We have an accessibility review scheduled one week from today, but honestly, I want to get the known issues resolved beforehand.
Comment #9
waako commentedI've done work towards fixing the aria-pressed, also removing the unnecessary aria-expanded on menu containers.
Also added a focus trap for mobile menu.
https://github.com/Lullabot/olivero-poc/pull/11
Comment #10
mherchelThis looks great! Merged!
Comment #11
mherchelComment #12
andrewmacpherson commentedGood work!
As @waako says, the proposed solution in the issue summary isn't correct. I've updated the code sample to put aria-expanded in the correct place. If using ARIA, it's very important you use it correctly.
I'm not convinced by the keyboard focus trap:
#5:
Yes. This hasn't been addressed yet. The current arrangement of navigation landmarks is poor. At the moment, the navigation landmarks only exist when the menu button is expanded. If a user looks for a navigation landmark, they won't find one. These shouldn't disappear and re-appear, the landmark should always be there.
Next steps:
Improve the landmarks.
nav button + ulis the element structure needed (and divs if you want).The same thing needs to be done for the other disclosure button in the primary menu (products +). Currently this has very crappy keyboard behaviour; the submenu is just visually hidden, and appear when focus is within the sub-menu. Keyboard users have no choice but to tab through them. Better to hide the sub-menu links for all users, and only reveal them when the button is pressed. This problem affects both breakpoints.