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:
After doing this the model's attribute will be "testin", as the field never received the last keyup event.
@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:
@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.
issue #6 Keyup event fired too late
@hlindset Thanks for the help. I got this resolved on master.