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

fix: set aria-selected on selected item, not the focused one #5402

Merged
merged 2 commits into from
Jan 26, 2023

Conversation

web-padawan
Copy link
Member

@web-padawan web-padawan commented Jan 26, 2023

Description

Fixes #720

This PR fixes an issue found by @vursen while looking into the vaadin-list-box fix for aria-selected state.

For some historical reasons, we originally tried to announce focused item change by updating this attribute.
At least in VoiceOver this causes duplicate announcements: both the input text and item are announced.

Now when the <input> element is placed in light DOM and linked with the overlay, let's fix this logic.

Type of change

  • Bugfix

Testing

VoiceOver + Chrome

Both selected and not selected states are announced 🎉

vo-not-selected

vo-selected

Note, VoiceOver + Safari has known issues that don't seem to be affected by this PR: #2748

JAWS + Edge

Selected item is not announced. This problem also exists on master, I think it's because of focus not moving to the item.
This seems to be the same as #163 - we can't really do anything about it, without changing how combo-box works 😕

jaws

NVDA + Edge

Selected item is not announced, instead items that are not selected get announced. So it seems to work as expected 😎

nvda

@sonarcloud
Copy link

sonarcloud bot commented Jan 26, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

* @protected
* @override
*/
_isItemSelected(item, _selectedItem, itemIdPath) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On multi-select-combo-box, for some reason, VO always reads not-selected, selected for not selected items and selected, selected for selected items. This can be handled separately from this PR:

Screenshot 2023-01-26 at 17 39 30

Copy link
Contributor

@vursen vursen Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems to be a separate issue since it also happens on master. Also, ed31808 doesn't seem to have any effect on multi-select-combo-box.

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.0.0.alpha10 and is also targeting the upcoming stable 24.0.0 version.

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

Successfully merging this pull request may close these issues.

[combo-box] aria-selected is not updated with programmatic selection
4 participants