Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User names autocomplete: markup improvements #3329

Closed
afercia opened this issue Nov 3, 2017 · 3 comments
Closed

User names autocomplete: markup improvements #3329

afercia opened this issue Nov 3, 2017 · 3 comments
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).

Comments

@afercia
Copy link
Contributor

afercia commented Nov 3, 2017

Follow up to #2896

The user name suggestions list is currently implemented with an unordered list, where each list item contains a button. However, the role="listbox" expects their children to have the role="option". In other words, assistive technologies expect a listbox to be composed by a "Listbox" container and "option" children (just 2 nesting levels).

Also, the markup should be consistent with the one used for example for the links suggestions. Worth noting that, since we're using ARIA roles, the native semantics of UL and LI elements gets overridden. Basically we could use any element, because they will have the semantics of "listbox" and "option" anyways. The button is convenient to use, because it's an element that already has native keyboard interaction, but it won't be announced as "button".

I'd recommend to use the same markup used for the links suggestions. There's no need for an unordered list. Just a div (with role listbox) and buttons (with role option) are perfectly OK.

Rererence:
https://www.w3.org/TR/wai-aria/roles#listbox

List boxes contain children whose role is option.

@afercia afercia added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Nov 3, 2017
@afercia
Copy link
Contributor Author

afercia commented Nov 3, 2017

It's important to note that also small differences in the markup have an impact on how assistive technologies may announce an ARIA listbox (or other ARIA widgets). In the screenshots below, with the current markup VoiceOver announces each option as "text":

screen shot 2017-11-03 at 16 06 33

instead, with the "flat" markup structure "listbox > option", it announces "clickable". Other screen readers may behave differently.

screen shot 2017-11-03 at 16 05 56

@afercia
Copy link
Contributor Author

afercia commented Nov 3, 2017

For a comparison, see also the expected behavior as it works on the Twitter mentions:

screen shot 2017-10-20 at 10 37 49

@afercia
Copy link
Contributor Author

afercia commented Mar 1, 2018

Seems to me this can be closed now: as far as I can tell, all the "autocompleters" use the same component now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

No branches or pull requests

2 participants