Keyup event fired too late #6

hlindset opened this Issue Sep 24, 2012 · 5 comments


None yet

2 participants


There seems to be an issue with the keyup event being fired on the wrong field when quickly tabbing to the next field after typing. The keyup event is being fired on the field that was tabbed to instead of on the field that was typed in.

Steps to reproduce:

  1. Type "testing" in an input field
  2. Quickly tab away from the field

After doing this the model's attribute will be "testin", as the field never received the last keyup event.

delambo commented Sep 24, 2012

@hlindset Thanks for the report.

I'm trying to replicate here:

I'm not experiencing that behavior when I tab away quickly - you can see the model attribute populated in the DOM and in the console. Let me know if I got the test case wrong.


It happens when tab is pressed at almost the same time as the last character I type.

Here's an updated fiddle that prints the source element for the keyup event:

And a video demonstrating the behaviour:

delambo commented Sep 24, 2012

@hlindset Thanks for the modified fiddle and vid.

I think the tab keyup is firing before the last character keyup event. You can see this behavior when you hold down one key until it displays several characters, then without letting go hit the tab key, then after the tab has clearly moved to the next input let go of the key. Notice how you lose that last keyup/character which is exactly what happens in your examples.

Does this sound plausible?


Yes, sounds plausible to me.

The focus change when tabbing happens on keydown, so when the keyup event fires the focus has already been changed, thus the keyup event is fired for the "wrong" element. Binding the change-event in addition to keyup would solve that.

@delambo delambo added a commit that referenced this issue Sep 25, 2012
@delambo delambo issue #6 Keyup event fired too late 828fa69
delambo commented Sep 25, 2012

@hlindset Thanks for the help. I got this resolved on master.

@delambo delambo closed this Sep 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment