WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: Inspect is defaulting to light theme

Open ajtruckle opened this issue 1 year ago • 16 comments

What happened?

See:

image

Why is it defaulting to light?

If I go to the preferences of the inspector and say to use system preference then it goes back to dark:

image

Why is this?

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

127.0.2651.105

SDK Version

2592.51

Framework

Win32

Operating System

Windows 11

OS Version

No response

Repro steps

The pc should be using dark mode. Right click your webpage and use Inspect.

https://github.com/user-attachments/assets/c8f64cae-6384-4182-82a6-6d7b21f6377a

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

AB#53587380

ajtruckle avatar Aug 22 '24 16:08 ajtruckle

Same. Like a helicopter spotlight during night debug sessions! Please fix before I go blind!!!

frostius avatar Aug 28 '24 13:08 frostius

Now tested with:

  • Runtime: 128.0.2739.42
  • SDK: 2739.15

Same behaviour.

How come no response in a week? @champnic

ajtruckle avatar Aug 30 '24 19:08 ajtruckle

Added to the backlog - thanks!

champnic avatar Aug 30 '24 20:08 champnic

Saaaaaaame. It's like a jumpscare if you aren't prepared for it.

Jaegerwald avatar Sep 19 '24 15:09 Jaegerwald

It seems OK now? I am getting dark theme. But no one has said anything about it being fixed?

ajtruckle avatar Sep 24 '24 14:09 ajtruckle

@ajtruckle No, just buggy. Give it a few days, it'll go back to broke

frostius avatar Sep 24 '24 14:09 frostius

It seems OK now? I am getting dark theme. But no one has said anything about it being fixed?

Our team doesn't directly own the devtools inspect tool, so it's possible that the devtools team put in a fix for this issue on their end. What runtime do you see it working with?

champnic avatar Sep 24 '24 17:09 champnic

@champnic I spoke too early. Now I try again it persists white. Oh well.

ajtruckle avatar Sep 24 '24 17:09 ajtruckle

Thanks for confirming.

champnic avatar Sep 24 '24 17:09 champnic

Why there is light +(default) and dark +(default) ? image image

nduboi avatar Nov 28 '24 11:11 nduboi

It seems OK these past two days:

Image

ajtruckle avatar Feb 24 '25 20:02 ajtruckle

@champnic I am wondering if this can be closed now as working?

ajtruckle avatar Mar 03 '25 21:03 ajtruckle

@ajtruckle still always defaults to light for me. How do you "fix" it?

frostius avatar Mar 03 '25 21:03 frostius

@frostius See video:

https://github.com/user-attachments/assets/fca08081-47a6-4daf-8e6a-38a68a8db384

The only specific thing I do is:

m_pWebBrowser->SetPreferredColorScheme(IsUsingDarkMode()
	? COREWEBVIEW2_PREFERRED_COLOR_SCHEME_DARK
	: COREWEBVIEW2_PREFERRED_COLOR_SCHEME_LIGHT
);

ajtruckle avatar Mar 03 '25 21:03 ajtruckle

@ajtruckle Thanks. I updated my webview2 component and rebuilt, no change. Still doesn't default to system theme and doesn't remember theme.

I did not try to set the theme from code but I guess I may have to at some point at it would appear that non-copilot issues have been permanently deprecated as Microsoft across all project.

frostius avatar Mar 03 '25 23:03 frostius

I also see the similar issue. The theme I selected is not loading by default. The option I selelected is preserved, but it always loads light theme, while the selected theme shown as Dark.

Image

In the above image you can see, the selected theme is Dark, but the theme I see is light.

This happens only onload. If I go and explicitly change the theme, it is applying.

venkateshreddy avatar Nov 04 '25 12:11 venkateshreddy