KeyboardEvent.key values have been changed

Published: | Categories: DOM


The KeyboardEvent.key implementation has been updated for the latest DOM3 Events spec, and key values have been changed accordingly. For example, "Spacebar" becomes " " while "Add" becomes "+". Also, printable, generic keys now return the actual characters instead of "MozPrintableKey". Read the document for details.

Note that the legacy KeyboardEvent.charCode, KeyboardEvent.keyCode and KeyboardEvent.which properties are deprecated, and developers should consider using KeyboardEvent.key once the spec and implementation become stable.