javascriptfirefox

Firefox' »find as you type« is conflicting with JavaScript key events


Firefox has »find as you type« functionality, which is super awesome. But when developing JavaScript web applications and I want to react on key events, only the first key press is captured by the web page, subsequent keys all go to the find field.

Is there a way to disable this with vanilla JS? (no frameworks such as MooTools)

I tried return false; at the end of the event handler, but it does not work.


Solution

  • Have you tried the preventDefault() method on the event object?

    Also try to see the difference between binding to keyup/keydown/keypress (or maybe all of them) and see if there is a difference in controlling the events that way