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

Conditions 629 Autocomplete Move Focus into List #33010

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

williamphelps13
Copy link
Contributor

Summary

  • This is behind a feature toggle so will not impact prod
  • Changes:
    • Move Focus into List to try to solve the following:
      • NVDA/Firefox - the input value is read every time you navigate the dropdown options
      • JAWS/Chrome, Narrator/Edge - Cannot navigate through the dropdown options with UP + Down keys
    • Replace onBlur with eventListener that closes list only if click outside container and add tabIndex so that focus can go on list items.
    • Ensure any key press other than arrow up/down, enter, or escape, brings focus back to input.
    • Add focus onMouseEnter so that highlight and focus are always aligned.
    • Remove search onFocus functionality since this was firing with stale data whenever focusOnInput ran. Need to determine how to add back this functionality.
    • Remove updating aria text when arrow since this is now coming from focus
  • Which team do you work for, does your team own the maintenance of this component? Conditions Team and Yes

Related issue(s)

…WS a11y issue

Replace onBlur with eventListener that closes list only if click outside container and add tabIndex so that focus can go on list items. Ensure any key press other than arrow up/down, enter, or escape, brings focus back to input. Add focus onMouseEnter so that highlight and focus are always aligned. Remove search onFocus functionality since this was firing with stale data whenever focusOnInput ran. Need to determine how to add back this functionality.
@williamphelps13 williamphelps13 marked this pull request as ready for review November 13, 2024 21:52
@williamphelps13 williamphelps13 requested review from a team as code owners November 13, 2024 21:52
}
};

document.addEventListener('mousedown', handleClickOutside);
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want to switch this to mouseup so that users can change their mind about the action / cancel it. Check out this doc for more info: https://www.w3.org/WAI/WCAG21/Understanding/pointer-cancellation.html#dfn-down-event

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed with: b32cbf1

I tried canceling the action to test this change, but even moving the mouse out of the browser window still resulted in the list closing. I read this: "They normally receive visual feedback when an item is pressed. If they discover they have selected the wrong item, they can cancel the action by moving their pointer or finger away from the target before releasing." Are you able to cancel the action in the UI now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Doh sorry I got this one wrong, it would be mouse up when selecting the item. This is related to handleClickOutside. Let's switch it back to mouse down 😅 Sorry!

@va-vfs-bot va-vfs-bot temporarily deployed to master/conditions-629-autocomplete-focus-in-list/main November 14, 2024 05:23 Inactive
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

Successfully merging this pull request may close these issues.

3 participants