electron/spec/fixtures/pages/tab-focus-loop-elements-wv.html
Pedro Pontes 9c783f53ba fix: do not allow the window to grab focus when tabbing / shift+tabbing (#16042)
* fix: do not allow the window to grab focus when tabbing / shift+tabbing

* test: add tests.
2018-12-18 23:44:51 -07:00

25 lines
663 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<body>
<div>
<button id="wv-element-1">Button 1</button>
<button id="wv-element-2">Button 2</button>
</div>
<script>
const { ipcRenderer } = require('electron')
function handleFocusChange(event) {
if (event.target.tagName) {
const elementId = event.target.id ? `-${event.target.id}` : ''
const elementIdentifier = `${event.target.tagName}${elementId}`
ipcRenderer.send('focus-changed', elementIdentifier)
}
}
addEventListener('focus', handleFocusChange, true)
</script>
</body>
</html>