Open
Description
What happened?
One of our frontend site relies on focus
event to function properly, and I noticed this event handler triggered twice the first time the window was clicked. And this does NOT happens in Edge / Cef / Chrome.
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
No response
SDK Version
No response
Framework
Win32
Operating System
Windows 10, Windows 11
OS Version
No response
Repro steps
- Create a
index.html
with this
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<style>
div {
background-color: white;
}
</style>
</head>
<body>
<div id="container">
</div>
<script>
let i = 0;
addEventListener("focus", ()=>{
let container = document.getElementById('container');
let newDiv = document.createElement('div');
newDiv.innerHTML = `focus #${i}`;
++i;
container.appendChild(newDiv);
})
</script>
</body>
</html>
- Use whatever live server to host this page, use the official win32 starting sample and change the startup url from bing to this.
- Build it, run the exe without debugger.
- Click on the window, notice the event handler was called twice.
In this video, the first exe is the win32 official getting start sample, the second exe is cefsimple
2024-03-13.18-39-39.mp4
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response