Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

mdSelect options must be rendered at load time, not just on interaction #4977

Closed
marcysutton opened this issue Oct 2, 2015 · 2 comments
Closed
Assignees
Labels
a11y This issue is related to accessibility
Milestone

Comments

@marcysutton
Copy link
Contributor

In working on #3859 and #4914, I came across an issue that has existed for a while (I've mentioned it to @rschmukler a few times):

The options for an mdSelect are not in the DOM at all until you click or use the keyboard to activate it. For screen readers, this means a relationship cannot be established between the select and the options it controls, causing an error in Chrome's A11y Developer Tools:

[Severe] Elements with ARIA roles must ensure required owned elements are present (1)

Here is the part of the ARIA spec this error refers to: http://www.w3.org/TR/wai-aria/roles#mustContain

Furthermore, when the options are rendered, they go into a separate part of the DOM. We can bind a relationship with aria-owns, however, that attribute also requires the matching element to be rendered at load time. When I went to do the work required for #3859, I got even more errors in the Chrome A11y audit stemming from this issue. So the problem isn't going away.

Recommended fix: inject the options on page load so the required ARIA relationships can be established. We can then test aria-owns on mdSelect and decide if the options are accessible enough when rendered in a separate part of the DOM.

For async, we could put in at least one option to start (like a placeholder). I'm not sure how accessible this will be, since it might not refresh the accessibility tree reliably, but it's worth a try.

@marcysutton marcysutton added the a11y This issue is related to accessibility label Oct 2, 2015
@calebegg
Copy link
Member

calebegg commented Oct 5, 2015

Role combobox also technically requires an owned element with role "textbox" (because a combobox normally has an editable text field at the top), though from your investigation in #3859, I think that's not really worth addressing (if NVDA and JAWS both consider the built-in <select> as a "combobox" even though it's not). But it does mean that the audit will continue to fail even if this is fixed.

@ThomasBurleson ThomasBurleson modified the milestone: 1.0-rc3 Nov 1, 2015
@rschmukler rschmukler modified the milestones: 1.0-rc4, 1.0-rc3 Nov 4, 2015
@rschmukler rschmukler modified the milestones: 1.0-rc5, 1.0-rc4 Nov 11, 2015
@rschmukler rschmukler modified the milestones: 1.0-rc6, 1.0-rc5 Nov 19, 2015
@marcysutton
Copy link
Contributor Author

This highlights some of the gaps with native controls and ARIA support. Even though role=combobox is suggested as "a presentation of a select" in the ARIA spec, it doesn't fit the use case where there is no text input, or one that needs to be multiselectable. I think it's fine to use role=listbox in this case, since it will at least tell a screen reader user that they are interacting with some kind of list control.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants