Skip to content

Slight delay in new non-empty validation causes Enter key to be missed #23354

kamens opened this Issue Jun 5, 2012 · 1 comment

2 participants

Khan Academy member
kamens commented Jun 5, 2012

@aksaigal @beneater

The new checkIfAnswerEmpty logic can cause a very subtle but frustrating user experience. There is a slight delay between entering an answer and the validation firing, which means that when you are working on fast problems and hit, say, "9" followed by "Enter" very quickly, the Enter will be missed. You then have to hit Enter again.

This may sound trivial, but it causes a weird psychological effect because you find yourself in an anticipatory state after you enter your answer, waiting for the button to be enabled, and then trying to time your press of Enter. I think we want to avoid this.

I've looked into this briefly and believe this is caused by the fact that we're firing the validator on the keyup event. If you're typing quickly, you may hit Enter before you finish keying-up your answer.

Firing this event on keypress fixes the problem. I've verified that, but I haven't verified if there are any other problems caused by this change or anything else to look out for. @aksaigal, will leave this final call up to you.

@aksaigal aksaigal was assigned Jun 5, 2012
aksaigal commented Jun 5, 2012

I fixed this by enabling the button on every keypress and then checking whether or not the button should be enabled on the keyup.

@aksaigal aksaigal closed this Jun 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.