Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions files/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,26 @@ $(function() {
}
run.click(onRun);
})

// Current workaround for the issue https://todo.sr.ht/~eliasnaur/gio/415
// where keydown and keyup listeners don't work
window.addEventListener('keydown', (e)=> {
const frames = document.querySelectorAll('iframe')
frames.forEach((frame)=> {
const input = frame.contentDocument.querySelector('input')
if (input) {
input.dispatchEvent(new KeyboardEvent('keydown', {key:e.key}))
}
})
});
window.addEventListener('keyup', (e)=> {
const frames = document.querySelectorAll('iframe')
frames.forEach((frame)=> {
const input = frame.contentDocument.querySelector('input')
if (input) {
input.dispatchEvent(new KeyboardEvent('keyup', {key:e.key}))
}
})
});
})