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

Aria-selected not being set (with fix) #566

Open
benvand opened this issue Sep 30, 2022 · 2 comments
Open

Aria-selected not being set (with fix) #566

benvand opened this issue Sep 30, 2022 · 2 comments

Comments

@benvand
Copy link

benvand commented Sep 30, 2022

if (requestedOption) { requestedOption.selected = true }

Had a problem with this not being set properly, will come back to flesh out issue later

@benvand benvand changed the title [DRAFT] Not sure if this works Aria-selected not being set (with fix) Sep 30, 2022
@benvand
Copy link
Author

benvand commented Sep 30, 2022

In the default onConfirm for accessible autocomplete we try to set the 'selected' property. This is wrong.
https://www.w3schools.com/tags/att_option_selected.asp

As per docs above selected is used to indicate an option selected by default on page load not the currently selected option.

aria-selected on the other hand:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected

Should be set.

This can be set by changing the line highlighted:
from
if (requestedOption) { requestedOption.selected = true }v
to
if (requestedOption) { requestedOption.ariaSelected = true }

I can't do this right now so if anyone fancvies a low hanging fruit contribution and putting together a PR then there's a freebie.

@benvand
Copy link
Author

benvand commented Sep 30, 2022

Uploading Screenshot 2022-09-30 at 11.48.11.png…

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

No branches or pull requests

1 participant