You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am adding multi-profile support to our app. Everything is working fine except that context menus always seem to be displayed in PreferredColorScheme.Dark despite setting CoreWebView2.Profile.PreferredColorScheme = PreferredColorScheme.Light.
I have tried to reproduce this in the WebView2WpfBrowser sample app but am encountering a different - but probably related - issue. In the sample app, setting CoreWebView2.Profile.PreferredColorScheme sets the PreferredColorScheme for all profiles, not just the current profile.
The documentation for PreferredColorScheme is:
The PreferredColorScheme property sets the overall color scheme of the WebView2s associated with this profile.
As such I believe this behavior is incorrect as demonstated in this video (follow the repro steps below to recreate):
Profile.vs.PreferredColorScheme.mp4
Note: This issue is also present in Edge. If I open two Edge windows using two different profiles, they both use whichever appearance I set last.
As I cannot recreate the behavior we are seeing in our app, I am reporting this bug and hoping that someone might be able to shed some further light on the issue.
Importance
Important. My app's user experience is significantly compromised.
Start the sample app and follow these steps:
a. Select some text on the webpage and right click to bring up the context menu
-> ✅ Context menu appears in system's preferred color scheme
b. Use "New Window → Create with Options" to create a WebView in a Profile named Light
-> 🚫 First window immediately changes to "Light" theme (e.g. scroll bars change colour) as soon as the WebView on the new window is initialized to have "Light" colour scheme.
c. Reselect some text on the webpage in the first window and right click to bring up the context menu
-> 🚫 Context menu appears in Light mode
d. Use "New Window → Create with Options" to create a WebView in a Profile named Dark
-> 🚫 Both windows immediately changes to "Dark" theme (e.g. scroll bars change colour) as soon as the WebView on the new window is initialized to have "Dark" colour scheme.
e. Reselect some text on the webpage in the first window and right click to bring up the context menu
-> 🚫 Context menu appears in Dark mode
Rebuild the app with the SETVIACONTROLLER compilation symbol (which will set Profile.PreferredColorScheme via a CoreWebView2Controller instead of the WebView2 instance
Repeat testing steps from step 4. Issue still appears but CoreWebView2.Profile.PreferredColorScheme shows Auto for all windows instead of the actual color scheme set for that profile.
Repros in Edge Browser
Yes, issue can be reproduced in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered:
What happened?
I am adding multi-profile support to our app. Everything is working fine except that context menus always seem to be displayed in
PreferredColorScheme.Dark
despite settingCoreWebView2.Profile.PreferredColorScheme = PreferredColorScheme.Light
.I have tried to reproduce this in the WebView2WpfBrowser sample app but am encountering a different - but probably related - issue. In the sample app, setting
CoreWebView2.Profile.PreferredColorScheme
sets thePreferredColorScheme
for all profiles, not just the current profile.The documentation for
PreferredColorScheme
is:As such I believe this behavior is incorrect as demonstated in this video (follow the repro steps below to recreate):
Profile.vs.PreferredColorScheme.mp4
Note: This issue is also present in Edge. If I open two Edge windows using two different profiles, they both use whichever appearance I set last.
As I cannot recreate the behavior we are seeing in our app, I am reporting this bug and hoping that someone might be able to shed some further light on the issue.
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
130.0.2849.56
SDK Version
1.0.2895.0-prerelease
Framework
WPF
Operating System
Windows 11
OS Version
22000.2538
Repro steps
MainWindow.InitializeWebView
to set thePreferredColorScheme
based onProfileName
as shown below:MainWindow.UpdateTitle
to showProfile.ProfileName
andProfile.PreferredColorScheme
as follows:a. Select some text on the webpage and right click to bring up the context menu
-> ✅ Context menu appears in system's preferred color scheme
b. Use "New Window → Create with Options" to create a WebView in a Profile named
Light
-> 🚫 First window immediately changes to "Light" theme (e.g. scroll bars change colour) as soon as the WebView on the new window is initialized to have "Light" colour scheme.
c. Reselect some text on the webpage in the first window and right click to bring up the context menu
-> 🚫 Context menu appears in Light mode
d. Use "New Window → Create with Options" to create a WebView in a Profile named
Dark
-> 🚫 Both windows immediately changes to "Dark" theme (e.g. scroll bars change colour) as soon as the WebView on the new window is initialized to have "Dark" colour scheme.
e. Reselect some text on the webpage in the first window and right click to bring up the context menu
-> 🚫 Context menu appears in Dark mode
SETVIACONTROLLER
compilation symbol (which will setProfile.PreferredColorScheme
via aCoreWebView2Controller
instead of theWebView2
instanceCoreWebView2.Profile.PreferredColorScheme
showsAuto
for all windows instead of the actual color scheme set for that profile.Repros in Edge Browser
Yes, issue can be reproduced in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered: