electron/spec/fixtures/pages/key-events.html
Shelley Vohr ec9c8476fe
fix: keyCodes being incorrectly converted in webContents.sendInputEvent() (#39776)
fix: sendInputEvent keyCodes being incorrectly converted
2023-09-12 11:28:45 +02:00

18 lines
554 B
HTML

<html>
<body>
<input type="text" id="input" autofocus/>
<script type="text/javascript" charset="utf-8">
const { ipcRenderer } = require('electron')
document.onkeydown = function (e) {
ipcRenderer.send('keydown', e.key, e.code, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey)
}
document.onkeypress = function (e) {
ipcRenderer.send('keypress', e.key, e.code, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey)
}
document.onkeyup = function (e) {
ipcRenderer.send('keyup', e.key, e.code, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey)
}
</script>
</body>
</html>