You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example usage to allow for backwards compatibility from above link:
Order of preference:
event.key
event.keyIdentifier
event.keyCode
window.addEventListener("keydown", function (event) {
if (event.defaultPrevented) {
return; // Should do nothing if the default action has been cancelled
}
var handled = false;
if (event.key !== undefined) {
// Handle the event with KeyboardEvent.key and set handled true.
} else if (event.keyIdentifier !== undefined) {
// Handle the event with KeyboardEvent.keyIdentifier and set handled true.
} else if (event.keyCode !== undefined) {
// Handle the event with KeyboardEvent.keyCode and set handled true.
}
if (handled) {
// Suppress "double action" if event handled
event.preventDefault();
}
}, true);
The text was updated successfully, but these errors were encountered:
event.keyCode
is deprecated.https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
Example usage to allow for backwards compatibility from above link:
Order of preference:
event.key
event.keyIdentifier
event.keyCode
The text was updated successfully, but these errors were encountered: