MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2

Home Page:https://aka.ms/webview2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: WPF hybrid - touch in WebView2 makes mouse invisible even when moving over WPF

wgala-tomra opened this issue · comments

What happened?

Hello!

We have hybrid application that has WPF and Blazor (presented by WebView2 WPF control) in it. We are in transition from WPF to Blazor which takes time, so we change it part by part. Because of WebView2's airspace issue we cannot fully convert our views to Blazor, we need to do it step by step doing small parts like notifications, that appear always on top first. So most of the WebView2 areas are quite small and may be closed on tap/click.

App:
We provide touchscreen app with mouse support when it is connected. App is running on machine with touch panel, which sometimes needs to be accessed via remote desktop and by people not having touchscreen, so they need mouse/keyboard support. Also, there are cases when there users being near machine and connecting to the machine are giving access to the machine to each other.

Bug:
When tapping (touching) on WebView2 part of application it makes mouse cursor invisible (this is expected). The problem is that mouse doesn't go visible on mouse moving on WPF part. When moving out of the application window mouse appears, when entering application which is still in WPF it disappears again. Once mouse movement is on WebView2/Blazor part it appears again, both for WebView2 part and WPF. Since we have small things that may disappear once it's clicked/tapped done in Blazor it may be very hard to restore mouse by the user (which is not aware of such issue and which parts are in Blazor).

Remarks:
While investigating issue I have noticed that WebView2 is setting cursor flag to hidden (0x00) instead of CURSOR_SUPPRESSED which should be the case for touch actions (https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-cursorinfo). I believe this is the main cause here.

Also, I have noticed that WebView2 control doesn't mouse move to the location where touch occurred.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

124.0.2478.67

SDK Version

1.0.2478.35

Framework

WPF

Operating System

Windows 10

OS Version

10.0.19045

Repro steps

I have created simple WPF window that is helpful to reproduce issue. Left half of the window is WebView2 WPF control and right part is WPF (red background)

<Window x:Class="BlazorWPF.SampleBlazor"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        xmlns:wpf="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" 
        Title="SampleBlazor" Height="400" Width="800"
        Background="Red">
    <Grid>
        <wpf:WebView2 Width="400" 
                      Height="400" 
                      HorizontalAlignment="Left"
                      VerticalAlignment="Top"
                      Source="https://bing.com">

        </wpf:WebView2>
        <Button Width="120" Height="40"
                HorizontalAlignment="Right"
                VerticalAlignment="Top">Click me</Button>
    </Grid>
</Window>

Steps:

  • move mouse on red area (WPF area)
  • tap/touch on Bing search (WebView2) part of the screen (cursor disappears - as expected)
  • move mouse over red area, without hovering over Bing part (cursor is hidden - not expected)
  • move mouse out of application (cursor is now visible)
  • move mouse to red area, without hovering over Bing part (cursor is hidden- not expected)
  • move mouse to Bing part (notice that mouse cursor is visible again)
  • move mouse to red part (cursor is visible)

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

AB#50630885

Was able to repro this issue, it will be tracked in out backlog