Fix keypress detection in Firefox