Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading a file breaks WebView2 DefaultBackGroundColor transparency #1108

Closed
emimvi opened this issue Mar 23, 2021 · 2 comments
Closed

Downloading a file breaks WebView2 DefaultBackGroundColor transparency #1108

emimvi opened this issue Mar 23, 2021 · 2 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@emimvi
Copy link

emimvi commented Mar 23, 2021

Description

When using a transparent background WebView2, downloading sometimes breaks the transparency.
It happens quite often but it's not fully consistent. Sometimes it just blinks, other times it stays white until the window is resized or loses focus. I haven't tested whether other DefaultBackgroundColors are being overwritten with white.

Version
SDK: 1.0.774.44
Runtime: Evergreen 89.0.774.57
Framework: WinForms
OS: Win10

Repro Steps

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

namespace WinFormsApp1
{
	static class Program
	{
		/// <summary>
		///  The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.SetHighDpiMode(HighDpiMode.SystemAware);
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			var form = new Form();
			form.BackColor = System.Drawing.Color.HotPink;
			WebView2 webView = new WebView2();
			webView.Dock = DockStyle.Fill;
			webView.DefaultBackgroundColor = System.Drawing.Color.Transparent;
			AsyncInit(webView);
			form.Controls.Add(webView);
			Application.Run(form);
		}
		static async void AsyncInit(WebView2 webView)
		{
			await webView.EnsureCoreWebView2Async();
			string html = "<html><body><a href='https://file-examples-com.github.io/uploads/2017/02/file_example_CSV_5000.csv'> Download file </a></body></html> ";
			webView.CoreWebView2.NavigateToString(html);
		}
	}
}

Screenshots
Pre download:
PreDownload
Post download:
PostDownload

AB#32257764

@emimvi emimvi added the bug Something isn't working label Mar 23, 2021
@champnic
Copy link
Member

Thanks @emimvi for the bug report and repro steps! I was able to see this locally. It looks related to the way the download bar is interacting with the rest of the content - it's probably adding a white background somewhere. When I dismiss the download bar it becomes transparent again. I've opened this bug on our backlog and we'll take a look. Thanks!

@champnic champnic self-assigned this Mar 26, 2021
@champnic champnic added the tracked We are tracking this work internally. label Mar 26, 2021
@champnic
Copy link
Member

champnic commented Jun 5, 2021

This should be fixed in runtimes 92.0.893.0+. Thanks!

@champnic champnic closed this as completed Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

2 participants