-
Notifications
You must be signed in to change notification settings - Fork 55
[Problem/Bug]: Context Menu Icon is Cached #5203
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
Comments
Hi @jussij Do you have a sample app where I can repro this issue? |
I don't have any simple app that demonstrates this. What I will try is adding this context menu to one of the WebView2 sample apps to see if I can replicate the issue there. But having thought about this, I think the dark mode portion of the bug report is irrelevant. If the code was changed to just cycle between one of two menus using a static counter and a mod 2, the same issue should be observer. As the context menu is repeatedly displayed, I suspect the labels would change to match the state of the counter mod2, but the icon would stay the same. In any case, I'll try to create a simple app to reproduce the issue and if I manage this, I'll put it on GitHub and post a link here. |
I've modified one of the WebView2 sample projects to replicate this issue. That modified project can be found here: https://github.com/jussij/WebView2SampleWinComp.git My changes are prefix by this comment: Most of the changes are made to this file: Building and running this application loads a web page that displays a 'WebView sample page' in the center of the application. Right clicking on that central region brings up a context menu containing a new menu item that was added in the If you dismiss and redisplay the popup, you'll notice the menu text cycles through two menu labels (light and dark), but the menu icon does not. The image below shows how the text of the label changes, but the green icon always remains green: And if you now change this line of code found in the
making it this:
Now the context menu always displays the blue icon: So, while the code adding the new menu item can control the text of the new menu item, it has no control over the icon. The icon appears to always take the value of the first icon used, as if the image has been cached. |
Is this a private repo? I'm unable to access it. |
My mistake. I forgot to make it public. You should now have access. |
What happened?
I have this code that adds a menu item to the context menu of the WebVeiw2 based on the current dark mode setting.
The WebBrowser is a control contained in a modeless popup dialog and the popup menu is working as expect as shown below:
When the modeless dialog is left open and the dark mode is changed, the WebVeiw2 control response to the change in dark mode as expected.
However, when the context menu is displayed, while the menu item label now reflects the new dark mode, the icon does not change as shown below:
If the modeless dialog is closed and reopened the context menu icon then synchs up with the current dark mode as shown in the earlier image.
So, it would appear that the icon is somehow being cached somehow, despite it being created each time the context menu is requested.
Why is it behaving the way it does, and can this be fixed?
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
No response
SDK Version
No response
Framework
Win32
Operating System
Windows 10
OS Version
19045.5737
Repro steps
The issue is described in the comment and the code.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
The text was updated successfully, but these errors were encountered: