[Problem/Bug]: WebView2CompositionControl doubleclick on webpage object is not working in .NET4.8 framework app
What happened?
When we implement WebView2CompositionControl to open webpage that contains code below. The double-click on paragraph isn't working.
`
Double-click this paragraph to trigger a function.
`Importance
Blocking. My app's basic functions are not working due to this issue.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
132.0.2957.140
SDK Version
1.0.3065.39
Framework
WPF
Operating System
Windows 11
OS Version
22631.4751
Repro steps
The code snippet below with navigate to simple html code below is enough to reproduce the issue. webviewapp.yaml code snippet. `<ScrollViewer> <wv2:WebView2CompositionControl Name="webView" /> </ScrollViewer>
<wv2:WebView2CompositionControl Name="webView2"/>`
index.html code snippet. `
Double-click this paragraph to trigger a function.
`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
Dear dev team Is there any update related to this issue? Do you need support from my side? Thank you Robert
The WebView2CompositionControl has a double-click event OnMouseDoubleClick. You can override the OnMouseDoubleClick event of WebView2CompositionControl to make it do nothing.
public class CustomWebView2CompositionControl : WebView2CompositionControl
{
protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
{
// Do nothing
}
}
@xceyds That's work. It looks like a good workaround until WebView2CompositionControl itself solves using some of the additional settings.
@wdedeveloper you may try the same
Hello
This workaround seems to be working on my test application ...
I did add the handler of doubleclick event into Javascript code and I can see log records in console after doubleclick on a test box text.
See JavaScript code snippet.
function loadFunction() { document.getElementById("inpTest").focus() document.getElementById("inpTest").addEventListener("dblclick", event => { console.log("dblclickHandler event"); }); }
Load function loads input inpTest text box and I can see coubleclick events in logs of Console. When I double click text included in block.
Thank you I hope dev team will provide fix soon. Robert
It seems the double click does not properly work in the composite control.
This html is working fine in the regular webview2 control but not in the composite control. The button text does not get changed
<!DOCTYPE html>
<html>
<head>
<title>Double Click Counter</title>
<script>
let count = 0;
function handleDoubleClick(button) {
count++;
button.textContent = "Double-Clicks: " + count;
}
</script>
</head>
<body>
<button ondblclick="handleDoubleClick(this)">Double-Clicks: 0</button>
</body>
</html>