Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not allow the window to grab focus when tabbing / shift+tabbi…
…ng (#16042) * fix: do not allow the window to grab focus when tabbing / shift+tabbing * test: add tests.
- Loading branch information
1 parent
ed3e573
commit 9c783f5
Showing
5 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!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> |