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 radio keyboard events #1199

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

Conversation

joshferrell
Copy link

What:
There is currently an issue with the behavior of radio inputs and the user-event library. Because the walkRadio method does not break out of the loop when iterating through options, it can sometimes skip over the correct option.

There's also an issue where the direction that the arrow up and arrow down keys were swapped. Arrow down should increment and arrow up should decrement.

Fixes issue: #1198

Why:

There was an issue with the robustness of the tests where going through the radio options, only A and D were possible. So the tests were just flipping between the only two available radio options. Adding an additional radio input breaks the tests.

How:

I've updated the tests to include an additional radio input to ensure that behavior is correct. I've also added an additional tests to ensure that radio inputs behave correctly for aria-disabled as they should still be focusable. This matches the browser behavior.

Checklist:

  • [N/A] Documentation
  • Tests
  • Ready to be merged

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@joshferrell joshferrell changed the title Fix radio events Fix radio keyboard events Feb 27, 2024
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.

2 participants