WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: WebView2CompositionControl doubleclick on webpage object is not working in .NET4.8 framework app

Open wdedeveloper opened this issue 10 months ago • 3 comments

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.

`

WpfTestdotNetFW.zip

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

wdedeveloper avatar Feb 12 '25 16:02 wdedeveloper

Dear dev team Is there any update related to this issue? Do you need support from my side? Thank you Robert

wdedeveloper avatar Mar 04 '25 08:03 wdedeveloper

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 avatar Apr 08 '25 01:04 xceyds

@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

yashvaghani9115 avatar Apr 10 '25 13:04 yashvaghani9115

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

wdedeveloper avatar Apr 22 '25 08:04 wdedeveloper

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>

dos-ise avatar Jun 23 '25 10:06 dos-ise