electron/spec/fixtures/pages/tab-focus-loop-elements.html
Samuel Attard 186301e126
feat: enable context isolation by default (#26890)
* feat: enable context isolation by default

* chore: set default in ctx iso getter

* spec: make all specs work with the new contextIsolation default

* spec: fix affinity specs

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* chore: move stray prod deps to dev deps

* spec: update tests for new ctx iso default

* turn off contextIsolation for visibility tests

* turn off contextIsolation for <webview> tag nodeintegration attribute loads native modules when navigation happens

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2021-03-01 16:52:29 -05:00

27 lines
837 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 webpreferences="contextIsolation=no"></webview>
<button id="element-3">Button 3</button>
</div>
</body>
</html>