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

Indicate dropdown selection with aria-selected attribute #2499

Open
alundgard opened this issue Jul 30, 2024 · 1 comment
Open

Indicate dropdown selection with aria-selected attribute #2499

alundgard opened this issue Jul 30, 2024 · 1 comment
Labels

Comments

@alundgard
Copy link
Member

Current behavior

aria-current is used to indicate a dropdown selection. Use aria-selected instead.

Steps to reproduce

Example page: Spotlight Accessibility for SODA - San Francisco Buildings.

Click on one of the dropdown menu options ("Sort by relevance," "12 per page").

Possible solution

WCAG Level A

See SODA's recommendation below.

Reported by SODA

Violation: Avoid inappropriate use of ARIA roles, states, and properties
Severity: Minor

[Issue]
The dropdown for the sorting uses aria-current to indicate which is selected. The appropriate attribute here is aria selected.

Note that aria-current is used for the the page selector at the bottom and is appropriate there.

[User Impact]
When inappropriate ARIA roles, states, and/or properties are used it may prevent users of assistive technology from correctly interpreting and interacting with the content.

[Code Reference]

<div class="dropdown-menu show" role="menu" x-placement="bottom-start" style="...">
  <a class="dropdown-item " role="menuitem" href="...">relevance</a>
  <a class="dropdown-item " role="menuitem" href="...">year (new to old)</a>
  <a class="dropdown-item active" role="menuitem" aria-current="page" href="...">year (old to new)</a>
  <a class="dropdown-item " role="menuitem" href="...">author</a>
  <a class="dropdown-item " role="menuitem" href="...">title</a>
  <a class="dropdown-item " role="menuitem" href="...">publisher</a>
</div>

[Recommendation]
Change aria-current to aria-selected="true".

@alundgard alundgard added the a11y label Jul 30, 2024
@jcoyne
Copy link
Contributor

jcoyne commented Jul 31, 2024

Is this because we are combining links and role="menuitem"? I believe aria-current is appropriate for links, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants