This repository was archived by the owner on Aug 5, 2025. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork238
This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Cannot focus on input element inside iframe when the editor has focus. #167
Description
Describe the problem
Cannot focus oninput element insideiframe when the editor has focus.
- Reproduction
- visithttps://learn.svelte.dev/tutorial/named-form-actions
- click the editor
- click the input element in iframe
focus_issue_480p.mov
This is probably related to#161.
I suppose the intent of#161 is to considerpointerdown event as a human operation. However, events that occur insideiframe cannot be handled from outsideiframe.
learn.svelte.dev/src/routes/tutorial/[slug]/Editor.svelte
Lines 243 to 249 in8d0376c
| <svelte:window | |
| on:pointerdown={(e)=> { | |
| if (!container.contains(/**@type{HTMLElement}*/ (e.target))) { | |
| preserve_focus=false; | |
| } | |
| }} | |
| /> |
learn.svelte.dev/src/routes/tutorial/[slug]/Editor.svelte
Lines 266 to 272 in8d0376c
| on:focusout={()=> { | |
| if (preserve_focus) { | |
| setTimeout(()=> { | |
| instance?.editor.focus(); | |
| },0); | |
| } | |
| }} |
Describe the proposed solution
whenbody element insideiframe gets focus, set focus on the editor. (usingpostMessage)
Metadata
Metadata
Assignees
Labels
No labels