28 lines
800 B
HTML
28 lines
800 B
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title></title>
|
||
|
<script>
|
||
|
const { ipcRenderer } = require('electron')
|
||
|
|
||
|
function handleFocusChange(event) {
|
||
|
if (event.target.tagName && event.target.tagName !== 'WEBVIEW') {
|
||
|
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>
|
||
|
<div>
|
||
|
<button id="element-1">Button 1</button>
|
||
|
<button id="element-2">Button 2</button>
|
||
|
<webview src="tab-focus-loop-elements-wv.html" nodeintegration></webview>
|
||
|
<button id="element-3">Button 3</button>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|