Skip to content

Commit

Permalink
samples: event.keyCode is deprecated, use new .code API (#2125)
Browse files Browse the repository at this point in the history
Some browser don't support `code` so I added a fallback for `keyCode`

Co-authored-by: Benjamin E. Coe <bencoe@google.com>
  • Loading branch information
code913 and bcoe committed Mar 19, 2022
1 parent e086dfa commit 0bb49c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion example/yargs.html
Expand Up @@ -35,7 +35,7 @@
const input = document.getElementById('input');
const output = document.getElementById('output');
input.addEventListener('keydown', event => {
if (event.keyCode === 13) { // Enter.
if (event.key === "Enter" || event.code === "Enter" || event.keyCode === 13) { // Enter.
const argv = yargs.parse(input.value, (err, argv, _output) => {
if (output) {
output.value += `\n${_output}`;
Expand Down

0 comments on commit 0bb49c3

Please sign in to comment.