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

[Problem/Bug]: web messages aren't posted while the system context menu is up #4794

Open
pushkin- opened this issue Sep 4, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@pushkin-
Copy link

pushkin- commented Sep 4, 2024

What happened?

I listen for messages posted to the app in my WebMessageReceived handler.

That handler won't fire while the system context menu is up (Alt+Space)

Even after the context menu is dismissed (like via Escape), it seems like I have to click in the webview2 for the messages to start getting processed.

This is causing my app to effectively hang while the context menu is up since the webapp is waiting on some messages to get processed which never happens.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

128.0.2739.54

SDK Version

1.0.2535.41

Framework

Winforms

Operating System

Windows 11

OS Version

22631.4037

Repro steps

  1. download the WinForms webview2 sample app from here: https://github.com/MicrosoftEdge/WebView2Samples
  2. in BrowserForm::AttachControlEventHandlers, add: control.WebMessageReceived += Control_WebMessageReceived; where the event handler just does a Debug.WriteLine('") or something.
  3. add this to the end of AppStartPage.js: setTimeout(() => { window.chrome.webview.postMessage("message"); }, 5000);
  4. Start the app
  5. if you wait 5 seconds, the breakpoint in WebMessageReceived will get hit.
  6. If you start the app and hit Alt+Space. The breakpoint won't get hit.
  7. If you then press escape to dismiss the context menu, the breakpoint still won't be hit.
  8. If you then click inside of the webview2 control, the breakpoint gets hit.

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

@pushkin- pushkin- added the bug Something isn't working label Sep 4, 2024
@vbryh-msft
Copy link
Contributor

@pushkin- you are saying that it does not repro in Edge. What have you tried there?

@pushkin-
Copy link
Author

pushkin- commented Sep 6, 2024

@vbryh-msft I could only pick yes or no, so I picked no. I have no idea if it's an Edge problem or not. I'd need to know if there is some WebMessageReceived thing that is awaited and trigger a postmessage.

@mgalla10
Copy link

Interestingly enough, this only seems to occur when the system context menu is shown via Alt+Space. If it's instead shown by right-clicking the application's title bar, the web requests are posted as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants