Skip to content

[Problem/Bug]: Tooltip gets stuck in case of two active browsers #5215

Closed
@fvanheeswijk

Description

@fvanheeswijk

What happened?

When two WebView2 browser windows are created within the same application, and you open (*) a tooltip in one window and then hover over another window which also opens a tooltip and then lose focus, then one of the two tooltips remains active on the screen on top of any other application, until the application itself is closed.

This is very annoying to our users as now they have tooltips floating on their screen as long as our application is active.

(*) A tooltip is in this case opened by hovering over an image with a title.

Importance

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

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

136.0.3240.29

SDK Version

1.0.3179.45

Framework

Winforms

Operating System

Windows 11

OS Version

10.0.26100

Repro steps

This issue can be reproduced as follows with the included test project. Please also see the attached video showcasing the issue:

  1. Run the application and click twice on the 'Open WebView2 Form' button, this will open two forms containing WebView2 instances.
  2. Make sure these forms overlap.
  3. Activate the tooltip in the first form by hovering over the image.
  4. Now activate the tooltip in the second form by hovering over its image, note that the tooltip of the first form won't disappear.
  5. Lose the focus of these forms.
  6. Observe that the tooltip will remain in place on top of all other windows, until the application has been closed.

Image

using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Web.WebView2.WinForms;

static class Program
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Environment.SetEnvironmentVariable("WEBVIEW2_RELEASE_CHANNEL_PREFERENCE", "1");
        Application.Run(new MainForm());
    }
}

public class MainForm : Form
{
    public MainForm()
    {
        var openWebViewButton = new Button
        {
            Text = "Open WebView2 Form",
            Dock = DockStyle.Fill,
            Font = new Font("Arial", 12, FontStyle.Bold),
            ForeColor = Color.White,
            BackColor = Color.DarkBlue,
            Padding = new Padding(10)
        };

        openWebViewButton.Click += (sender, e) =>
        {
            var webViewForm = new WebViewForm();
            webViewForm.Show();
        };

        Controls.Add(openWebViewButton);
        Text = "Main Form";
        StartPosition = FormStartPosition.CenterScreen;
        Size = new Size(300, 200);
        BackColor = Color.LightGray;
    }
}

public class WebViewForm : Form
{
    private readonly WebView2 webView;

    public WebViewForm()
    {
        Text = "WebView2 Form";
        StartPosition = FormStartPosition.CenterScreen;
        Size = new Size(800, 600);
        BackColor = Color.White;

        webView = new WebView2 { Dock = DockStyle.Fill };
        Controls.Add(webView);

        Load += async (sender, e) =>
        {
            await webView.EnsureCoreWebView2Async();
            webView.CoreWebView2.NavigateToString(@"
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <svg width=""600"" height=""400"" xmlns=""http://www.w3.org/2000/svg"">
            <title>Image</title>
            <rect width=""600"" height=""400"" fill=""#d3d3d3"" />
        </svg>
    </body>
</html>"
            );
        };
    }
}

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

135.0.3179.85

Metadata

Metadata

Labels

bugSomething isn't workingregressionSomething used to work but doesn't anymoretrackedWe are tracking this work internally.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions