vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
457 stars 84 forks source link

[select] item navigation controls suggested by VoiceOver don't work [0.5 day] #2930

Open tomivirkki opened 2 years ago

tomivirkki commented 2 years ago

What is the problem?

With VoiceOver on

  1. open https://a11y-vaadin-playground.netlify.app/pages/v22/select.html
  2. open the first <vaadin-select> dropdown
  3. See the suggested controls

Screenshot 2021-10-26 at 12 25 59

However, Control-Option-Shift-Down Arrow does nothing

May be that the dropdown/list-box roles aren't correct so a wrong kind of an announcement is shown

Browsers

Screen Readers

yuriy-fix commented 2 years ago

We need to figure out if it is a problem in avatar-group and menu-bar.

web-padawan commented 2 years ago

Tested this for other components:

vaadin-avatar-group

Chrome

The role is announced as "group". Also, the VoiceOver cursor does not move to item:

screenshot ![chrome-avatar-group](https://user-images.githubusercontent.com/10589913/182380623-5473613d-19a8-4ae0-9b41-b01599f97b6a.png)

Safari

The role is announced as "text element" (this is expected, as VoiceOver does not annonce role="option", unlike native <option> element). The VoiceOver cursor is moved to the item in the list-box:

screenshot ![safari-avatar-group](https://user-images.githubusercontent.com/10589913/182380673-d63d51be-0e28-45fb-b46d-d9538cb80a5e.png)

vaadin-select

Chrome

Same as in vaadin-avatar-group: the VoiceOver cursor remains on the vaadin-select-value-button:

screenshot ![chrome-select](https://user-images.githubusercontent.com/10589913/182382889-465ef4d0-9394-4b12-b615-ef56bc199f98.png)

Safari

Same as in vaadin-avatar-group: the VoiceOver cursor is moved to the item in the list-box:

screenshot ![safari-select](https://user-images.githubusercontent.com/10589913/182382940-8db91100-f622-44fc-b631-e9ae3da00ccd.png)

vaadin-menu-bar

This component is not affected, most likely because it's using role="menuitem" which has different item navigation. Also, the VoiceOver cursor is correctly moved to the item in the overlay when using VoiceOver on Chrome.

web-padawan commented 2 years ago

One more issue about item navigation in Safari: when moving to different item using Control + Shift + Arrow Down and pressing Enter, the wrong item is selected, as the keyboard focus is not in sync with the VoiceOver cursor 😕

https://user-images.githubusercontent.com/10589913/182384389-22051ff2-5930-45f4-bd38-6cb3facdd5c5.mp4

UPD: this problem also exists in the ARIA examples when using VoiceOver on Chrome 🤷‍♂️

web-padawan commented 2 years ago

Regarding the original issue, I could not get VoiceOver outline working on Chrome. Here are some things that I tried:

  1. Postpone calling this._menuElement.focus() until vaadin-overlay-open event is fired,
  2. Disable animations for vaadin-select-overlay (the way it's done in our visual tests),
  3. Set aria-controls attribute on the vaadin-select-value-button to link it to list-box.

Regardless of those steps, the behavior of the VoiceOver cursor doesn't change:

  1. When pressing Enter, the VoiceOver cursor remains on vaadin-select-value-button
  2. When pressing Arrow Down, the VoiceOver cursor then moves to the whole list-box

https://user-images.githubusercontent.com/10589913/182564309-5e523647-a882-436d-9348-9fb885ad6c89.mp4

web-padawan commented 2 years ago

Looks like something is wrong with either vaadin-list-box or vaadin-item. Using div with correct roles works. Also, using custom elements that set correct roles (without using tabindex) works fine, too:

menu-button

Code example ```html Menu button ```