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
Ability to change element focus between type
events
#295
Comments
Hi @kayleighridd, I can visualize the kind of experience you're describing... What if instead of firing all the events on the element that's passed, we first focus that element and then reference the |
@kentcdodds yes, that would be ideal 🎉 |
I would expect this to be more of a bug fix than a breaking change. It probably should always have done this. Would you be interested in making a pull request for this? I notice your github profile doesn't have public activity, so if this is new for you that's great! I'm happy to help you along as much as you'd like :) |
Okay great. Yeah, I'm happy to raise a pull request for this, thanks! |
type
eventstype
events
👋 I've raised a PR for this here: #299 |
Currently all the
keyUp
,keyPress
andkeyDown
events withintype
fire on the specified element, but it would be useful to be able to fire these on the currently active element so that focus can change between these events.My use case is a multi input field where I change the focus as input reaches its max character length so that the value is added to the next input.
I do this by changing the input focus on the
keyDown
event so that thekeyUp
event fires in another input.When I am testing, I'd like to specify a
type
event on one input, but confirm that the focus has moved and the value added to the next input.Here is a quick sandbox to illustrate my use case:
https://codesandbox.io/s/userevents-type-events-firing-on-same-element-not-active-element-229sk
(Code sandbox doesn't seem to respect the jsdom-sixteen test env so the error isn't correct, but hopefully it gives some context)
The text was updated successfully, but these errors were encountered: