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

White flash during page loading #414

Closed
pdc-tstream opened this issue Aug 29, 2020 · 6 comments
Closed

White flash during page loading #414

pdc-tstream opened this issue Aug 29, 2020 · 6 comments
Labels
feature request feature request

Comments

@pdc-tstream
Copy link

pdc-tstream commented Aug 29, 2020

Is there any way to show any color other than white while the page is loading?

Most of our embedded pages are dark.

Current hack is to hide the view during ContentLoading, and then reshow it with a timeout after NavigationCompleted.

This works but as you can imagine introduces latency and is prone to error.

AB#28898913

@champnic
Copy link
Member

This is the browser's behavior, so unlikely we'll change it. I'll create a feature request in our backlog to investigate though.

Currently changing the browser's theme from "Light" to "Dark" uses a dark gray background while the page is loading. Would that work for your scenario if we exposed a way to change the theme?

@champnic champnic added the feature request feature request label Aug 31, 2020
@pdc-tstream
Copy link
Author

Thanks for the quick feedback - setting to Dark would be better than the white flash.

I have two followups please:

  1. Any way to know when rendering really starts?

As I mentioned, the hack I'm doing now hides the WebView2 HWND during ContentLoading and shows it "sometime after" NavigationCompleted (can't show it immediately because even then I get a white flash). So I'm wondering if there's a way for me to know when rendering has actually started? Because then I can hook that and SW_SHOW the HWND.

I'm going to see if I can insert some javascript to detect when rendering starts, perhaps that's the only path right now.

  1. "But CEF can do it"

In general I think it's non-productive to say "But ZZZ can do it", so I apologize in advance. My intent is positive. Since both solutions are using Chromium so this might be super useful for you : CefSettings::background_color is what we're using today in our app.

Lastly, a plea:

I believe this is more important than it might at first seem.

Many apps are darker colors these days and those apps will suffer from this white-flash if they attempt to use WebView2. I get that there's lots of stuff you're working towards and this seems trivial, but the user experience could be so much better.

Thanks for all the hard work you guys are doing. We are really happy to be moving towards WebView2.

@champnic
Copy link
Member

  1. Websites can choose to draw themselves in any number of ways, so it's really difficult to know when a generic page is done loading and painting for avoiding flashes, changes, etc. I think your idea of inserting javascript to message back to the host is the right choice here. It sounds like you're designing your own HTML/JS to render, so your page will know best about when it's safe to show it.

  2. It's actually great to know that CEF can do this. This helps us prioritize the ask - we know it's important enough that a competitor has it, and that if important enough to a dev they may choose the competitor - and we know it's doable (and hopefully not overly complex to implement). :)

Thanks!

@pdc-tstream
Copy link
Author

Thanks for your responsiveness - good to see the API review, looks good to me.

We especially appreciate the transparency mode, as we may end up using that instead.

Thanks!

@johna-ms
Copy link
Contributor

Left and deleted a comment last night because I wasn't sure I'd made the announcement at the appropriate time. Turns out I was fine so I'm reposting, but thanks for taking a look!

Hi all, I'm working on a background color API to address this. Would appreciate if any of you could take a look and give your feedback!

#809

@champnic
Copy link
Member

@pdc-tstream The new DefaultBackgroundColor API is now available in 1.0.781-prerelease! It also supports setting a transparent color. Please give that a try and let us know if you find any issues. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request
Projects
None yet
Development

No branches or pull requests

3 participants