Affecting Non-printable keys will soon stop firing keypress event

Published: | Categories: DOM


In order to follow the UI Events spec and other browsers’ behaviour, Firefox will stop dispatching the keypress event for non-printable keys and key combinations in the near future.

Non-printable keys are function keys like Home, End, Tab, Escape, Backspace, Page Down, arrows, etc. Non-printable key combinations include Ctrl+A, Alt+G, Command+Shift+M and so on. Web developers should be using the keydown event instead to handle those keys.

An exception is the Enter key; pressing Enter with no modifiers, Shift+Enter or Ctrl+Enter will fire the keypress event as before, which is invalid in the current spec but compatible with other browsers.

This change has been made to the Nightly and early Beta/DevEdition channels as of Firefox 60. Other channels will also adopt the standard-compliant behaviour once compatibility issues on major sites are solved. Currently, some keyboard shortcuts on Gmail, Google Docs and Google Sheets are known to be broken.

Update: The change, originally requested by Google, has been temporarily backed out to give Google engineers time to fix the issue in their apps.