Commit ba9be65
fix(keyboard): forward iframe keydown events to parent window
When a slide or preview iframe receives focus, keydown events fire in
the iframe's own browsing context and never reach the parent window's
listener. This broke arrow-key navigation and the fullscreen shortcut
(f/F) in DeckViewer, and the fullscreen shortcut in PreviewPane.
Fix: on each iframe's onLoad, attach a keydown listener to its
contentWindow that re-dispatches the event on the parent window.
A shared isEditableTarget() helper (src/lib/iframe-key.ts) guards
against forwarding keys typed into INPUT/TEXTAREA/contentEditable
controls. The naive `instanceof HTMLElement` check is intentionally
avoided — it fails across window realms because the element's prototype
chain belongs to the iframe's HTMLElement, not the parent's.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 5055fd1 commit ba9be65
3 files changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
| |||
106 | 116 | | |
107 | 117 | | |
108 | 118 | | |
| 119 | + | |
109 | 120 | | |
110 | 121 | | |
111 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
| |||
297 | 307 | | |
298 | 308 | | |
299 | 309 | | |
| 310 | + | |
300 | 311 | | |
301 | 312 | | |
302 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments