Closed storsletten closed 4 years ago
Thank you so much for the feedback. It is greatly appreciated!
I think we need to split the current component into two different ones, and choose solution 1 for the "Ruleset" dropdown and the shopping cart (add an item to cart from the product page), as that isn't really a menu dropdown (nor dialog, listbox or grid). The menu dropdowns ("Men" and "Women" dropdowns, plus language selector) should use solution 2, though.
Would you agree on my conclusions above?
I'll prepare a PR on this as soon as possible, and post a link to a preview on how it will work. (Love deploy previews in Netlify!)
Yes, that sounds good.
After initially building two versions like described above, I stepped back and considered what most users might expect when navigating the menu. If I am not mistaken, the arrow key navigatio also requires the menubar/menuitem roles, which should be reserved for application menus, instead of navigation menus.
Because of this, as well as my assumption that most users would try pressing tab instead of using the arrow keys to navigate the dropdown menus, I went with the simplest solution for now, just removing aria-haspopup
for all dropdowns. (Alternative 1 above)
We will do user testing later, and if anyone comments on this, I'll of course reconsider this approach.
I hope you consider this a sufficient approach!
Yes. Since the dropdown appears right after the button in the DOM, aria-expanded will suffice here. If the dropdown and the button had been located on different parts of the page (e.g. dropdown being appended to the end of body), then a technique involving aria-owns would have been needed to establish a relation between button and dropdown. I wish I could say aria-controls, but since screen readers don't really support it, it wouldn't have had the desired effect. The aria-controls attribute is a sad chapter in the history of ARIA, but that's a topic for another discussion.
The dropdown component uses aria-haspopup="menu", which means screen readers that use a virtual cursor will disengage that cursor to let the application handle navigation by arrow keys when the element is activated. Think of aria-haspopup as a promise that the application will handle keyboard navigation. For a menu, this means supporting navigation by arrow keys. This issue can be addressed in one of two ways: