MicrosoftEdge / MicrosoftEdge/WebView2Feedback
focus event triggered twice after window activated
@tochukwuIbeEkeocha is already working on this.
Since Mar 13, 2024.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
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.htmlwith 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
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.