diff --git a/apps/svelte.dev/src/routes/tutorial/[...slug]/Editor.svelte b/apps/svelte.dev/src/routes/tutorial/[...slug]/Editor.svelte index 7b7f753121..a11fdd7d8e 100644 --- a/apps/svelte.dev/src/routes/tutorial/[...slug]/Editor.svelte +++ b/apps/svelte.dev/src/routes/tutorial/[...slug]/Editor.svelte @@ -1,4 +1,4 @@ - { - if (!container.contains(/** @type {HTMLElement} */ (e.target))) { + onpointerdown={(e) => { + if (!container.contains((e.target as HTMLElement))) { preserve_editor_focus = false; } }} - on:message={(e) => { + onmessage={(e) => { if (preserve_editor_focus && e.data.type === 'iframe_took_focus') { editor_view.focus(); } @@ -228,11 +234,11 @@
{ + onfocusin={() => { clearTimeout(remove_focus_timeout); preserve_editor_focus = true; }} - on:focusout={() => { + onfocusout={() => { // Heuristic: user did refocus themmselves if iframe_took_focus // doesn't happen in the next few miliseconds. Needed // because else navigations inside the iframe refocus the editor.