[Problem/Bug]: Inspect is defaulting to light theme
What happened?
See:
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:
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
Same. Like a helicopter spotlight during night debug sessions! Please fix before I go blind!!!
Now tested with:
- Runtime: 128.0.2739.42
- SDK: 2739.15
Same behaviour.
How come no response in a week? @champnic
Added to the backlog - thanks!
Saaaaaaame. It's like a jumpscare if you aren't prepared for it.
It seems OK now? I am getting dark theme. But no one has said anything about it being fixed?
@ajtruckle No, just buggy. Give it a few days, it'll go back to broke
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 I spoke too early. Now I try again it persists white. Oh well.
Thanks for confirming.
Why there is light +(default) and dark +(default) ?
It seems OK these past two days:
@champnic I am wondering if this can be closed now as working?
@ajtruckle still always defaults to light for me. How do you "fix" it?
@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 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.
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.
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.