testing-library / user-event

🐕 Simulate user events
https://testing-library.com/user-event
MIT License
2.19k stars 249 forks source link

Radio inputs - using Arrow keys to navigate focuses incorrect inputs #1048

Open vgpena opened 2 years ago

vgpena commented 2 years ago

Reproduction example

https://codesandbox.io/s/ancient-forest-44xrzm?file=/src/App.js

Prerequisites

Render a group of at least 3 radio inputs that:

Expected behavior

Codesandbox test: https://codesandbox.io/s/ancient-forest-44xrzm?file=/src/App.test.js

Keyboard user events should follow the patterns outlined here.

Specifically, ArrowRight and ArrowDown should advance the focus within the radio group, wrapping back to the beginning if needed. ArrowLeft and ArrowUp should reverse the focus within the group, wrapping back to the end if needed.

Actual behavior

Arrow keys send focus to the wrong input in the Radio Group. E.g.,ArrowRight send focus through all the inputs to the last input in the group.

User-event version

14.4.3

Environment

Bug is reproducible in CodeSandbox, so skipping this section.

Testing Library framework:

JS framework:

Test environment:

DOM implementation:

Additional context

Radio group arrow functionality was added here - https://github.com/testing-library/user-event/pull/995

ph-fritsche commented 2 years ago

Thanks for the report :heart:

sjwilczynski commented 2 months ago

@ph-fritsche, @kentcdodds could we get this issue resolved? Also #1198 is a duplicate. There are 3 very similar PRs opened to get it fixed, could one be picked and merged?

kentcdodds commented 2 months ago

I'm afraid I have no bandwidth to work on this project :(

sjwilczynski commented 2 months ago

That is fair, I tagged you only because I saw you both as committers in the last ten commits to main. Do you know if there is anyone else apart from you and Philipp who could have the time to take a look?

kentcdodds commented 2 months ago

I'm thinking maintenance of this library has kind of fallen off I'm afraid.

If you're blocked I recommend just using fireEvent directly or jumping into a more wholistic solution with playwright.

sjwilczynski commented 2 months ago

Sad to hear it, particularly as tools like Storybook depend on it but thanks for sharing the suggestions

kentcdodds commented 2 months ago

Perhaps someone from storybook would be interested in taking maintenance! 🙏