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
arrow keys? #354
Comments
fireEvent is not part of the user-event library, it is dom-testing-library. The user-event library was created because of such issues with fireEvent for keyboard events, which in my experience it has been a lot better at. However, I'm not sure that user-event can simulate soft keys. I'll have to look at the source for user-events to see if soft-key support is possible. |
Apologies I did mean user event |
Ok, so there is no soft key support in user-event. |
Do you think it should be? |
Hmm. It's currently pretty simple to use: So you might think you could easily provide an object for softkey interaction: However, the 'type' method also handles strings of multiple characters: How would you include a soft key in this sequence? Perhaps if soft key is only supported for single key strokes. Otherwise you would have to provide an array of input keystrokes, which could get a bit messy. |
Probably related to #31 |
@kentcdodds (or anyone else) do you ever test arrow key functionality w/ RTL at all? |
I do with downshift using Cypress |
Actually I think we do with jest too. It's been a few years since I can't remember 😅 |
Jest?! If you happen to remember how I'd love to know. 🙌🏻😃 |
Awesome thanks! |
Support for key presses would be very useful. Think of typing 'hi' in a textarea, and using Or testing if hotkeys still work. |
We should be able to implement this relatively easily now that we have modifier support implemented. You'd put it somewhere around here: Line 109 in 4bbb4b9
|
Just found myself looking for this feature too. |
* feat(type): Implement cursor navigation with ArrowLeft and ArrowRight * refactor(navigation-key): use a Number instead to hit all the lines * test(type): simplify snapshot * style(type): remove whitespace Co-authored-by: Jesu Castillo <castillojesuj@gmail.com> Closes #354
🎉 This issue has been resolved in version 12.2.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
for the life of me I can't seem to be able to fire an event for a keypress with arrow keys on a radio button, is this a problem in jsdom, or am I crazy?
The text was updated successfully, but these errors were encountered: