Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Vertical tabs menu is not presented as navigation
Proposed resolution
Add a nav element to the vertical tabs.
Remaining tasks
TODO.
User interface changes
Improve document structure as conveyed to assistive tech.
No visual changes intended.
Original report by [username]
Spin-off from #2988431: [Meta] Accessibility plan for Media Library Widget. Comment #12.A.3 said "Vertical tabs menu is not presented as navigation".
Comment | File | Size | Author |
---|---|---|---|
#16 | 3035408-16.patch | 8.42 KB | seanB |
#16 | interdiff-12-16.txt | 960 bytes | seanB |
#12 | 3035408-12.patch | 8.39 KB | seanB |
Comments
Comment #2
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedInitially just separating this from #3035331: Improve keyboard focus behaviour of vertical tabs in MediaLibraryWidget. Will review later.
Comment #3
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedHaving a navigation landmark region inside a dialog sounds a bit strange to me, because we'd be dynamically changing the list of landmark regions when the dialog opens and closes. I'm going to ask about this one in the wider accessibility community.
I'm also not sure that a list of tabs amounts to navigation. In this case it's actually behaving more like an exposed filter for the view. Under the hood, it's a Views contextual filter, but the tabs have effectively put a UI on it. So it's more like we have our exposed filters in two different places in the dialog.
Whatever the case, our current Form API
'#type' => 'vertical_tabs'
does NOT have a navigation landmark. Instead the list is preceded by visually-hidden text saying they are vertical tabs.There is an ARIA pattern for tabs, but we don't currently use it in Drupal core, but there's a note about it in #2893640: Modernize ARIA usage, in line with ARIA 1.1 and the ARIA Authoring Practices guide.. However the ARIA tabs pattern is a bit controversial - the main worry is that many users are not familiar with it, and some user studies have been published where sighted keyboard users were confused by them. So I don't want to rush into using those until they have broader consensus in the accessibility community.
Updated (2019-06-18): fixed a broken issue link in this comment.
Comment #4
seanBThanks for looking into this. I'll leave this for now. Very curious to see what the best way would be to improve this.
Comment #5
tim.plunkettFixing tag
Comment #7
Wim Leers@andrewmacpherson Does that mean we should close this issue?
Comment #8
mgifford@andrewmacpherson & I talked about it. Let's leave this open. There is more that can be done, if only testing.
In looking for best practices, here are some related links:
Reasonably recent:
https://github.com/w3c/aria-practices/issues/459
Older articles:
http://simplyaccessible.com/article/danger-aria-tabs/
http://accessibleculture.org/articles/2010/08/aria-tabs/
Comment #9
phenaproximaSounds like we're waiting on a best practice to emerge from the W3C, so this is, essentially, postponed indefinitely.
However, that presents a bit of an issue from a release management standpoint. This issue is marked as a "must-have" child issue of #2988431: [Meta] Accessibility plan for Media Library Widget, which is itself a "must-have" child issue of #2834729: [META] Roadmap to stabilize Media Library. Which means, by extension, that Media Library cannot be marked stable until this issue is resolved.
So, we have a little problem here. We can't realistically block Media Library on the W3C, so we should probably re-prioritize this issue. We could either make it a "should-have" child of this issue, or remove it entirely from this issue and...get it to it when we get to it, regardless of Media Library's stability.
I won't change anything right now since it's not clear what the correct course of action is, but I'd like an accessibility expert to make the call on that. Then we can update this meta, and the release managers, accordingly.
Comment #10
mgiffordI think we can postpone this on https://github.com/w3c/aria-practices/issues/459
But @andrewmacpherson has dug into this more deeply that I have so would like it if he confirms this.
Comment #11
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedLet's put aside the tabs pattern from the WAI-ARIA Authoring Practices for now. That's a red herring in this issue. In any case, our current Form API vertical tabs component doesn't use that pattern, and for the time being I'd like to avoid having two components that both look like vertical tabs behave in two different ways. (Eventually, I'd like to use the ARIA tabs pattern for both of these. Just not today.)
In #3, I said I'd ask around in the wider accessibility community, about whether a navigation landmark region made sense inside a dialog. I chatted with Scott O'Hara from Paciello Group, and described the dialog. We agreed that having landmarks inside of a dialog was serious overkill; if a dialog needs landmark regions, then you need to simplify the dialog. We noted that the media library is a rather complex dialog, but thought it would still be best to avoid using landmark regions inside a dialog. The main reason is that conceptually a dialog isn't really part of the page; in native desktop apps it's actually a separate window. However in web pages the screenreader landmarks tool will show all of the landmarks for the parent document. (That may improve in the future if/when the
inert
attribute gains support.)For now, the problem that needs to be addressed is this part of comment #3:
What needs to be conveyed is that these controls behave as a filter. The action is "click this control to show image media items".
Here's the markup we currently have from
MediaLibraryUiBuilder::buildMediaTypeMenu()
:Good parts:
<ul>
).Bad parts:
TO FIX:
<button type="button"><span class="visually-hidden">Show </span>Image<span class="visually-hidden"> media</span></button>
. Take care to address WCAG SC 2.5.3 Label In Name. There should be no invisible text inside the visible label. It's okay to have visible text sandwiched between two hidden spans.AnnounceCommand
to inform the user about what changed: "Showing Image media."Comment #12
seanBAttached is a first patch that implements the changes suggested in #11.
1. Instead of making the links real buttons, I've added
role="button"
to the links. If we want to change the link elements to actual button elements, we need to either:- Make the menu a form with a submit button for each media type.
- Find a way to pass the URL we want to open to the button via a data attribute or something, so we can attach custom AJAX behavior via JS.
All options are not perfect and work around AJAX implementation limitations. For that reason, I chose to stick close to the current implementation.
2. Fixed.
3. Fixed.
4. Fixed. Added some explicit tests for it. Also added an extra test to make sure the links can be triggered using the spacebar now we added
role="button"
.Comment #13
seanBComment #14
phenaproximaWe should probably do something like
$assert_session->elementExists('named', ['link', 'Type Three'])->keyPress(32)
here, to avoid the possibility of calling a method on NULL.Overall, the code looks good here; I think this patch will live and die on accessibility review, so tagging for that.
Comment #15
rainbreaw CreditAttribution: rainbreaw as a volunteer and commented@phenaproxima @seanB @andrewmacpherson - I tested this with VoiceOver on Mac OS X in Safari and Chrome, and the behavior is clear and understandable.
I personally consider this an accessible solution and would like to suggest that it is now reviewed and tested by the community.
Comment #16
seanBThanks @rainbreaw! Fixed #14 as well.
Comment #17
phenaproximaWelp, I’m happy with this if y’all is. RTBC once testbot confirms.
Comment #19
Gábor HojtsySuperb, thanks all.