microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.36k stars 678 forks source link

Tooltip in webview2 is showed wrong location when scaling #8464

Open khoabui1412 opened 1 year ago

khoabui1412 commented 1 year ago

Describe the bug

I have custom web with tooltip:

<!DOCTYPE html>
<html>
<head>
    <title>Tooltip Example</title>
</head>
<body>
    <p>Hover over the word <span title="A small wingless bloodsucking insect that feeds on the blood of mammals and birds.">flea</span> to see a tooltip.</p>
</body>
</html>

Xaml code:

        <WebView2 x:Name="web"
                  DefaultBackgroundColor="WhiteSmoke">
            <WebView2.RenderTransform>
                <ScaleTransform ScaleY="2"
                                ScaleX="2" />
            </WebView2.RenderTransform>
        </WebView2>

when the Scale X, ScaleY is different than 1, the position of tooltip is wrongly showed in webview2.

Steps to reproduce the bug

Run custom web above with scale not equal 1.

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

sreejeshs-dev commented 1 year ago

I got this issue while stretching (scaling) the webview2 window to the second screen(stretched in first and in second) in a two monitor setup, the hover popup appears on the second monitor even though the html element is on the first.