diff --git a/site/content/examples/06-lifecycle/02-update/App.svelte b/site/content/examples/06-lifecycle/02-update/App.svelte index 3eb2dceb52..419e763c57 100644 --- a/site/content/examples/06-lifecycle/02-update/App.svelte +++ b/site/content/examples/06-lifecycle/02-update/App.svelte @@ -20,7 +20,7 @@ ]; function handleKeydown(event) { - if (event.which === 13) { + if (event.key === 'Enter') { const text = event.target.value; if (!text) return; @@ -103,4 +103,4 @@ - \ No newline at end of file + diff --git a/site/content/examples/06-lifecycle/03-tick/App.svelte b/site/content/examples/06-lifecycle/03-tick/App.svelte index c9cb6de420..477b5ffb79 100644 --- a/site/content/examples/06-lifecycle/03-tick/App.svelte +++ b/site/content/examples/06-lifecycle/03-tick/App.svelte @@ -4,7 +4,7 @@ let text = `Select some text and hit the tab key to toggle uppercase`; async function handleKeydown(event) { - if (event.which !== 9) return; + if (event.key !== 'Tab') return; event.preventDefault(); @@ -34,4 +34,4 @@ } - \ No newline at end of file + diff --git a/site/content/examples/10-animations/00-animate/App.svelte b/site/content/examples/10-animations/00-animate/App.svelte index 279821491b..a90d0ecfb5 100644 --- a/site/content/examples/10-animations/00-animate/App.svelte +++ b/site/content/examples/10-animations/00-animate/App.svelte @@ -112,7 +112,7 @@
diff --git a/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte b/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte index d8c4caabef..a009b2cc1f 100644 --- a/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte +++ b/site/content/tutorial/07-lifecycle/03-update/app-a/App.svelte @@ -20,7 +20,7 @@ ]; function handleKeydown(event) { - if (event.which === 13) { + if (event.key === 'Enter') { const text = event.target.value; if (!text) return; @@ -104,4 +104,4 @@
- \ No newline at end of file + diff --git a/site/content/tutorial/07-lifecycle/03-update/app-b/App.svelte b/site/content/tutorial/07-lifecycle/03-update/app-b/App.svelte index bdf42e28a9..97caca99d5 100644 --- a/site/content/tutorial/07-lifecycle/03-update/app-b/App.svelte +++ b/site/content/tutorial/07-lifecycle/03-update/app-b/App.svelte @@ -20,7 +20,7 @@ ]; function handleKeydown(event) { - if (event.which === 13) { + if (event.key === 'Enter') { const text = event.target.value; if (!text) return; @@ -104,4 +104,4 @@ - \ No newline at end of file + diff --git a/site/content/tutorial/07-lifecycle/04-tick/app-a/App.svelte b/site/content/tutorial/07-lifecycle/04-tick/app-a/App.svelte index 3386ff93df..97edefa935 100644 --- a/site/content/tutorial/07-lifecycle/04-tick/app-a/App.svelte +++ b/site/content/tutorial/07-lifecycle/04-tick/app-a/App.svelte @@ -2,7 +2,7 @@ let text = `Select some text and hit the tab key to toggle uppercase`; async function handleKeydown(event) { - if (event.which !== 9) return; + if (event.key !== 'Tab') return; event.preventDefault(); @@ -32,4 +32,4 @@ } - \ No newline at end of file + diff --git a/site/content/tutorial/07-lifecycle/04-tick/app-b/App.svelte b/site/content/tutorial/07-lifecycle/04-tick/app-b/App.svelte index c9cb6de420..477b5ffb79 100644 --- a/site/content/tutorial/07-lifecycle/04-tick/app-b/App.svelte +++ b/site/content/tutorial/07-lifecycle/04-tick/app-b/App.svelte @@ -4,7 +4,7 @@ let text = `Select some text and hit the tab key to toggle uppercase`; async function handleKeydown(event) { - if (event.which !== 9) return; + if (event.key !== 'Tab') return; event.preventDefault(); @@ -34,4 +34,4 @@ } - \ No newline at end of file + diff --git a/site/content/tutorial/10-transitions/08-deferred-transitions/app-a/App.svelte b/site/content/tutorial/10-transitions/08-deferred-transitions/app-a/App.svelte index e869816730..f05c581390 100644 --- a/site/content/tutorial/10-transitions/08-deferred-transitions/app-a/App.svelte +++ b/site/content/tutorial/10-transitions/08-deferred-transitions/app-a/App.svelte @@ -56,7 +56,7 @@
e.which === 13 && add(e.target)} + on:keydown={e => e.key === 'Enter' && add(e.target)} >
@@ -145,4 +145,4 @@ label:hover button { opacity: 1; } - \ No newline at end of file + diff --git a/site/content/tutorial/10-transitions/08-deferred-transitions/app-b/App.svelte b/site/content/tutorial/10-transitions/08-deferred-transitions/app-b/App.svelte index 3cb21a8ed9..b7447ca7de 100644 --- a/site/content/tutorial/10-transitions/08-deferred-transitions/app-b/App.svelte +++ b/site/content/tutorial/10-transitions/08-deferred-transitions/app-b/App.svelte @@ -56,7 +56,7 @@
e.which === 13 && add(e.target)} + on:keydown={e => e.key === 'Enter' && add(e.target)} >
@@ -152,4 +152,4 @@ label:hover button { opacity: 1; } - \ No newline at end of file + diff --git a/site/content/tutorial/11-animations/01-animate/app-a/App.svelte b/site/content/tutorial/11-animations/01-animate/app-a/App.svelte index 3cb21a8ed9..b7447ca7de 100644 --- a/site/content/tutorial/11-animations/01-animate/app-a/App.svelte +++ b/site/content/tutorial/11-animations/01-animate/app-a/App.svelte @@ -56,7 +56,7 @@
e.which === 13 && add(e.target)} + on:keydown={e => e.key === 'Enter' && add(e.target)} >
@@ -152,4 +152,4 @@ label:hover button { opacity: 1; } - \ No newline at end of file + diff --git a/site/content/tutorial/11-animations/01-animate/app-b/App.svelte b/site/content/tutorial/11-animations/01-animate/app-b/App.svelte index 6194dd941e..0d232bf02b 100644 --- a/site/content/tutorial/11-animations/01-animate/app-b/App.svelte +++ b/site/content/tutorial/11-animations/01-animate/app-b/App.svelte @@ -57,7 +57,7 @@
e.which === 13 && add(e.target)} + on:keydown={e => e.key === 'Enter' && add(e.target)} >
@@ -155,4 +155,4 @@ label:hover button { opacity: 1; } - \ No newline at end of file + diff --git a/site/src/routes/repl/[id]/_components/AppControls/index.svelte b/site/src/routes/repl/[id]/_components/AppControls/index.svelte index 007dba3461..10639e91c0 100644 --- a/site/src/routes/repl/[id]/_components/AppControls/index.svelte +++ b/site/src/routes/repl/[id]/_components/AppControls/index.svelte @@ -30,7 +30,7 @@ $: canSave = $session.user && gist && gist.owner === $session.user.uid; function handleKeydown(event) { - if (event.which === 83 && (isMac ? event.metaKey : event.ctrlKey)) { + if (event.key === 's' && (isMac ? event.metaKey : event.ctrlKey)) { event.preventDefault(); save(); } diff --git a/test/runtime/samples/action-custom-event-handler-this/_config.js b/test/runtime/samples/action-custom-event-handler-this/_config.js index 194fa08c31..88a30232ab 100644 --- a/test/runtime/samples/action-custom-event-handler-this/_config.js +++ b/test/runtime/samples/action-custom-event-handler-this/_config.js @@ -4,7 +4,7 @@ export default { test({ assert, component, target, window }) { const input = target.querySelector('input'); const event = new window.KeyboardEvent('keydown', { - which: 13 + key: 'Enter' }); let blurred = false; diff --git a/test/runtime/samples/action-custom-event-handler-this/main.svelte b/test/runtime/samples/action-custom-event-handler-this/main.svelte index a7347cdc99..c3ace108a5 100644 --- a/test/runtime/samples/action-custom-event-handler-this/main.svelte +++ b/test/runtime/samples/action-custom-event-handler-this/main.svelte @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/test/runtime/samples/window-event-custom/_config.js b/test/runtime/samples/window-event-custom/_config.js index 207fad1b0b..1c1075c0de 100644 --- a/test/runtime/samples/window-event-custom/_config.js +++ b/test/runtime/samples/window-event-custom/_config.js @@ -3,7 +3,7 @@ export default { async test({ assert, component, target, window }) { const event = new window.KeyboardEvent('keydown', { - which: 27 + key: 'Escape' }); await window.dispatchEvent(event); diff --git a/test/runtime/samples/window-event-custom/main.svelte b/test/runtime/samples/window-event-custom/main.svelte index ce453d9334..ff286f4309 100644 --- a/test/runtime/samples/window-event-custom/main.svelte +++ b/test/runtime/samples/window-event-custom/main.svelte @@ -3,7 +3,7 @@ function esc(node, callback) { function onKeyDown(event) { - if (event.which === 27) callback(event); + if (event.key === 'Escape') callback(event); } node.addEventListener('keydown', onKeyDown); return { @@ -16,4 +16,4 @@ -

escaped: {escaped}

\ No newline at end of file +

escaped: {escaped}