Problem/Motivation
While working on #3507866: Enable the Navigation Top Bar when Navigation is enabled found that Navigation Top Bar has some accessibility issues disclosed by aXe Nightwatch tests.
This issues need to be solved before we can make the Top Bar stable.
From https://git.drupalcode.org/issue/drupal-3507866/-/jobs/4431574
️TEST FAILURE (1m 56s):
- 2 assertions failed; 1433 passed
✖ 1) Tests/a11yTest
– Accessibility - Navigation Module - Claro page (1.698s)
→ ✖ NightwatchAssertError
aXe rule: button-name - Buttons must have discernible text
In element: .toolbar-button--icon--dots
→ ✖ NightwatchAssertError
aXe rule: region - All page content should be contained by landmarks
In element: .top-bar__contextSteps to reproduce
- Use Firefox (Chrome has a bug with the More Actions menu that currently prevents it from visually showing up.
- Install latest Drupal 11.x Standard profile
- Enable
navigationandnavigation_top_barmodule - Create a piece of content, eg. an article
- View and/or edit that piece of content
Expected results
Inspect the source and look for .top-bar__context. Notice that of all its parent elements, none of those elements are landmark elements (eg. <aside>, <nav>, <main>, etc.. This is what the Axe error is complaining about. We expect that there will be a landmark parent element.
Using a screen reader, like VoiceOver, open up the Rotor (VO + U) and review the Landmarks menu. We expect that there is a landmark listed identifying the top bar.
Also, for the More Actions button, we expect it to have text available for non-sighted users that a screen reader can pick up. eg. this button:

Actual results
There is no landmark parent to the .top-bar__context element, and no landmark is identified in the VoiceOver Rotor Landmarks menu.
There is no text available for the more actions button for non-sighted users.
Proposed resolution
Add a wrapping landmark element for the Top Bar.
Add some visually hidden text for non-sighted users to describe the More Actions menu in the top bar.
Remaining tasks
Testing
User interface changes
Accessibility improvements for the Top Bar.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | more_actions.png | 170.68 KB | m4olivei |
Issue fork drupal-3508199
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
plopescComment #5
plopescSince this is not an easy bug to reproduce, created 2 branches:
3508199-navigation-top-bar-axe-test-only: It contains only the code necessary to make the error visible in Nightwatch tests3508199-navigation-top-bar-axe: It should contain the code necessary to make the error visible in Nightwatch tests + the changes to fix itOnce tests in
3508199-navigation-top-bar-axeare green and approved, might be necessary to create a new branch that contains only the code necessary to fix the error. This branch will contain a diff between the 2 original ones, and that's the one that should be merged.I know this is a bit tricky, but I have not been capable to figure out a better flow for this issue. If someone else have a better proposal, please feel free to show your concerns and ideas.
Comment #6
plopescComment #8
finnsky commentedI added a role and text for the button. Nw tests passed.
But a11y needs to be checked here.
And in general, what is top_bar? What is its role? Header or navigation?
Comment #9
m4oliveiI would argue it's not navigation, there are informational bits within it as well. I want to suggest we mark it up as an
<aside>with a title for screen readers. This follows what has been done with the sidebar.Will push an update to show what I mean.
Comment #10
m4oliveiComment #11
katannshaw commentedI've tested it using Apple VoiceOver, ARC Toolkit, and axe DevTools and everything looked good regarding the two reported issues:
I reviewed the code as well, and it all appeared to be set up properly from an accessibility perspective. The `` landmark is set up properly and didn't throw any errors with the automated checkers.
I did find one related issue when testing with the screen reader that needs to be resolved with this module or the main Navigation module itself.
Comment #12
finnsky commentedThank you!
It should gone with this MR landed:
https://www.drupal.org/project/drupal/issues/3483209
Comment #13
m4oliveiThanks @katannshaw!
OK, so now that we've had some solid accessibility testing done here. I think we're ready to move forward. As @plopesc noted in #5, what we've done here is first expose the Nightwatch axe rule errors by turning the Navigation Top Bar always on in the
3508199-navigation-top-bar-axe-test-onlybranch. The Nightwatch axe rule errors are here, or:Note that there are other test failures in there as well. This issue is solely focused on the Nightwatch axe rules error.
We've then fixed the Nightwatch axe rule errors in the
3508199-navigation-top-bar-axebranch. We can see that the Nightwatch axe rule errors are fixed here!The next step will be to take out the code that is exposing the navigation Top Bar here, b/c that is the work of #3507866: Enable the Navigation Top Bar when Navigation is enabled. Again, we're only interested in fixing the accessibility issue with the Navigation Top Bar here. I will next push this commit, and the
3508199-navigation-top-bar-axebranch, will be ready to merge!Comment #14
m4oliveiReady to go!
@plopesc and/or @finnsky could you review the MR, and my last comment?🤞 RTBC.
Comment #15
plopescCode looks good to me!
And it seems new bits fond are coming as part of other MRs.
Note for other reviewers: Instead of the 3 MRs approach suggested in #5, the lines of code that triggers the error are in MR 11257, which will be always green because the Top Bar is not going to be present since the line to force it have been reverted. Please check the previous pipeline to confirm that worked, or test it locally adding back those lines.
That MR is ready to be merged as it is.
Comment #18
nod_Committed 0b439c0 and pushed to 11.x. Thanks!
Comment #19
m4oliveiWant to note that this patch should get backported to 10.5.x once #3484564: Define the 3 areas the Top Bar will provide is backported.