Skip to content Skip to sidebar Skip to footer

Do Browser Key Events Fire (bubble) Only To Elements In Focus?

Experimental evidence has led me to believe that key (up, down, press) events fire (in bubble phase) only to elements in focus. This behavior may be intuitive, obvious and/or desir

Solution 1:

key events are always targeted to the element that has focus, and bubble up until cancelled.

You cannot press a key without an input element or the document/window itself being the target, and having the focus.

If you are looking at the parent of an input, and the focus changes to the window, you cannot find the next key event at the parent (because it isn't there), but you always find it at the document level.

Post a Comment for "Do Browser Key Events Fire (bubble) Only To Elements In Focus?"