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

Confusing rules of aria-expanded #1318

Open
kahlan88 opened this issue Jan 30, 2020 · 3 comments
Open

Confusing rules of aria-expanded #1318

kahlan88 opened this issue Jan 30, 2020 · 3 comments
Labels
editorial Changes to prose that don't alter intended meaning, e.g., phrasing, grammar. May fix inaccuracies. Example Page Related to a page containing an example implementation of a pattern

Comments

@kahlan88
Copy link

I've encountered conflicting information on aria-expanded attribute for menu buttons and listbox buttons.

https://www.w3.org/WAI/GL/wiki/Using_aria-expanded_to_indicate_the_state_of_a_collapsible_element and https://a11yproject.com/patterns/ say to set it to false when the menu/dropdown is closed.

document.getElementById(id2).setAttribute('aria-expanded', 'false');

while https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-links.html and https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/listbox-collapsible.html tell me otherwise:

The aria-expanded attribute is removed when the menu is closed.

We decided to go with false, but I am still not 100% sure which one is correct (or maybe both are?)

@JAWS-test
Copy link

I think both options are okay. Because of aria-haspopup, in one variant, you can perceive that there is something that can be faded in. In the other, it's perceptible due to aria-expanded=false.

@kahlan88
Copy link
Author

If both are okay, I think it would be helpful if both were mentioned where this is described. Or it can be mentioned as optional attribute for elements with closed menus. I'm sure I'm not the only person scratching their head over this :-)

@mcking65
Copy link
Contributor

mcking65 commented Feb 3, 2020

The states and properties section of the menu button design pattern includes the following language:

When the menu is displayed, the element with role button has aria-expanded set to true . When the menu is hidden, it is recommended that aria-expanded is not present. If aria-expanded is specified when the menu is hidden, it is set to false .

It is common for the example implementations of the design patterns to include optional or recommended characteristics. However, this is not the first question about an optional behavior that is not documented as such on the example page. We could do better here. I opened #1320.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial Changes to prose that don't alter intended meaning, e.g., phrasing, grammar. May fix inaccuracies. Example Page Related to a page containing an example implementation of a pattern
Development

No branches or pull requests

3 participants