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 accessibility regression and further improvements #96

Closed
wants to merge 6 commits into from

Conversation

Suyooo
Copy link

@Suyooo Suyooo commented Nov 4, 2022

This PR makes a few changes regarding accessibility. The module has been tested with the Orca screen reader on Linux.

  • The latest PR that added aria- attributes made a small mistake by using the attribute aria-role instead of role. The latter is the standard, the former does not exist. This resulted in a major regression in accessibility, as Orca would immediately switch away from focus mode back into browse mode when using the input (where most letters function as buttons to navigate the page, making it impossible to type anything). All occurences of aria-role have been replaced by role and now function correctly.
  • A couple of additions have been made to the handling of aria-activedescendant, which handles the currently selected option and makes the screen reader speak out that option when changed. However, due to how the IDs for the option divs are set, it was possible to receive changed suggestions, but have an option with the same ID selected, which resulted in no text being read out. To solve this, a string hash on the query string has been added into the IDs to ensure aria-activedescendant is updated when new results might be available. The div for emptyMsg has also been given a similar ID to allow screen readers to read it out.
  • Finally, a few more aria- attributes were added - aria-owns to mark the ownership relation in addition to the cause-and-effect relation, and aria-haspopup to make the screen reader tell the user that the input will open a listbox when used.

Since the result div IDs are simply using to the index number, the value in aria-activedescendant might not change, which results in screen readers not reading the selected option even if the value inside it has changed.
For example, with disableAutoSelect=true, type anything and press Down. The first option is selected and read. When then continuing to type and pressing Down again, the first option is selected, but not read, since aria-activedescendant has not changed.
This commit resets the value of the attribute. That means there is a change in the ID in both cases, and the options are read. However, for disableAutoSelect=false, the problem still exists.
Copy link

stale bot commented Mar 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 13, 2024
@stale stale bot closed this Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant