MicrosoftEdge / MicrosoftEdge/WebView2Feedback
WebView2 does not paint correctly when Form.Enabled is set to false
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Description
When you execute WebView2.FindForm().Enable = false; on an enabled form, then the WebView2 will go blank.
We expect it to remain the same, all it should do is not accept user input anymore.
Version
SDK: 1.0.865-prerelease
Runtime: Stable 90.0.818.51
Framework: WinForms
OS: Win10 Version 20H2
Repro Steps
We use the following code:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Web.WebView2.WinForms;
namespace WebView2BugFormEnabled
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(CreateTestForm());
}
public static Form CreateTestForm()
{
var form = new Form
{
Size = new Size(1280, 1024)
};
var webView2 = new WebView2
{
Dock = DockStyle.Fill,
Source = new Uri(@"https://github.com/MicrosoftEdge/WebView2Feedback/")
};
webView2.KeyDown += (sender, e) =>
{
webView2.FindForm().Enabled = !webView2.FindForm().Enabled;
};
form.Controls.Add(webView2);
return form;
}
}
}
When a key is pressed inside the web view, like F8, then the browser will go blank.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied WinForms entry point, especially CreateTestForm and its WebView2 key handler, and reproduce the blank view when Form.Enabled is set to false. Investigate the WebView2 WinForms behavior involved in disabling the form; done means the page remains painted while the disabled form no longer accepts user input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100