I have some code to be run:
- immediately after the
input
event handler if it's called - when this handler would usually be called if it's not.
I noticed that queuing a message with setTimeout
in the keydown
handler works well.
In this demo, the logged sequence is the one we expect:
- With a regular input : keydown | input | end
- When an input is prevented in the keydown handler (try entering the letter 'b') : keydown | end
- When hitting a key that doesn't trigger an input ('Escape') : keydown | end
So it seems to me that the input
event is queued before the keydown
event is processed, when we don't really know yet whether there will actually be an input. It's just what I need, but how can I be sure things are actually supposed to be implemented this way?