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

Decouple opening from focusing #235

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

josefarias
Copy link
Owner

@brunoprietog let me know this would improve accessibility.

It also conveniently fixes a flaky test which would sometimes fail when something would focus (and open) the combobox right as we're asserting that it's closed (see diff where I'm removing a sleep call — which did little to fix the flakiness).

@josefarias josefarias added the breaking For breaking changes label Jan 2, 2025
@@ -124,11 +124,9 @@ This gem follows the [APG combobox pattern guidelines](https://www.w3.org/WAI/AR

These are the exceptions:

1. Users cannot manipulate the combobox while it's closed. As long as the combobox is focused, the listbox is shown.
2. The escape key closes the listbox and blurs the combobox. It does not clear the combobox.
Copy link
Owner Author

Choose a reason for hiding this comment

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

Should add a test for this before merging.

Copy link
Owner Author

@josefarias josefarias Jan 2, 2025

Choose a reason for hiding this comment

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

Here's the corresponding example: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-both/

Pressing esc once will close the listbox, and keep the autocompleted portion highlighted.
Pressing it again will clear the combobox.

Pressing enter will similarly keep the autocompleted portion highlighted — I don't think we do that currently. Consider addressing in a separate PR. Thought about addressing here but that's also breaking so probably good to call attention to it in its own PR/changelog entry.

Note that the "enter" behavior described above does not apply after navigating the listbox options with the arrow keys.

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

Successfully merging this pull request may close these issues.

1 participant