question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown needs accessibility improvements

See original GitHub issue

The Dropdown component (I only tried the first one on the code page) has several accessibility problems:

  1. Having a label that disappears is not considered very accessible (similar to placeholder in text input not being considered very accessible). I have seen devs try to give this a label with <label> (which doesn’t work here) or hook up a span with aria-labelledby. Fixing this “disappearing label” problem may involve a slight redesign. 😃
  2. Typing Esc closes the list, but it also closes the side nav, so the key handler for Esc needs to stop propagation and maybe also prevent default.
  3. The markup is confusing to screen readers:
    • it thinks this is a “list with 2 items”: the bx–dropdown-text item and the item containing the dropdown list. It may help to to change the outer <ul> and the 2 <li> into divs (or give them role=“presentation”).
    • it doesn’t know that the dropdown list drops down, so it doesn’t tell the user that there’s a dropdown available
    • it reads all of the items in the dropdown list right away, even though they are not showing

Some aria may be needed to make this more understandable (maybe aria-haspopup=“listbox” and aria-expanded=“true/false”). Please read the “menu button” pattern and the “combobox” pattern in the ARIA Authoring Practices Guide to see what makes the most sense. They are both similar to what you are trying to achieve, I think.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
elizabethsjuddcommented, Jul 30, 2019

I’m planning on breaking this issue up in to multiple PRs just to keep the size of the changes easier for reviewing. The first PR will have HTML/styles (with minor JS changes just to keep it “working”) and the second PR will contain more robust JS changes for complete a11y updates.

1reaction
elizabethsjuddcommented, Jul 31, 2019

I combined the two PRs because the JavaScript wasn’t as big of updates as anticipated. This PR should close this issue as the first 2 items were already fixed so I focused on the screen reader experience updates.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessibility improvements to item list dropdown - Drupal
There are a few accessibility issues with the current implementation of item list dropdown. As suggested by lighthouse report ...
Read more >
Are Drop Down Menus WCAG 2.1 Accessible?
Wondering if your website's drop down menu is accessible? Learn more about the WCAG 2.1 requirements for navigation.
Read more >
Dropdown: accessibility improvements · Issue #1452 - GitHub
It will improve the accessibility experience for everyone who relies on the default DropdownEntry rendering and keep the current broken ...
Read more >
Building Accessible Menu Systems - Smashing Magazine
Navigation submenus (or "dropdowns" to some) work well with a mouse ... Not only is it easier to make responsive, and requires less...
Read more >
CSS-Only Accessible Dropdown Navigation Menu
This technique explores using: animation with CSS `transition` and `transform`, using the `:focus-within` pseudo-class, CSS grid, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found