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]: Shift and Enter key doesn't trigger KeyDown and KeyUp #4802

Open
pushkin- opened this issue Sep 10, 2024 · 5 comments
Open

[Problem/Bug]: Shift and Enter key doesn't trigger KeyDown and KeyUp #4802

pushkin- opened this issue Sep 10, 2024 · 5 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@pushkin-
Copy link

pushkin- commented Sep 10, 2024

What happened?

I have a KeyDown and KeyUp handler that is trying to detect hotkeys. I have some hotkeys with the Shift key. When the Shift key is let go of, I want to trigger the key up and send a message to my webapp to handle the hotkey.

Howevver, the Shift key being depressed doesn't trigger the KeyUp event.

So when I have a hotkey like ctrl+alt+shift+e, if the shift key is the first key that's let go of, we don't detect it and instead think that the hotkey is ctrl+alt+e (once one of the other keys is let go of). So I need to let go of one of the other keys first for the hotkey to get triggered.

Similarly, I have a hotkey with chords, e.g. ctrl+a shift+b. We can detect ctrl+a fine, but shift+b isn't detected.

Also, I observered the the Enter key also doesn't trigger the keydown/up events.

Passing --enable-features=msWebView2BrowserHitTransparent to the webview2 control fixes the issue but then it also breaks other keys. So for example, tabbing between fields is now broken. It's like I have to handle it myself and send it to the webview2 control? Not sure.

Similar to this issue, though not quite the same #2245

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

128.0.2739.67

SDK Version

1.0.2535.41

Framework

Winforms

Operating System

Windows 11

OS Version

22631.4037

Repro steps

  1. add a KeyDown and KeyUp event handler to the webview2 control and press shift or enter and compare to pressing ctrl

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

AB#54365248

@pushkin- pushkin- added the bug Something isn't working label Sep 10, 2024
@pushkin-
Copy link
Author

@tochukwuIbeEkeocha Maybe this is called out here. But if you can guide my on how to use that msWebView2BrowserHitTransparent flag in a way that doesn't break other characters like Tab, that would be helpful.

@pushkin-
Copy link
Author

possibly this is a dupe of #112

@pushkin-
Copy link
Author

pushkin- commented Oct 7, 2024

@tochukwuIbeEkeocha Any thoughts? This is blocking our app's release.

@victorhuangwq victorhuangwq added the tracked We are tracking this work internally. label Oct 10, 2024
@pushkin-
Copy link
Author

I guess I should clarify that the Shift/Enter isn't necessarily blocking the app's release. It's more that we can't intercept all keys via KeyDown/KeyUp since those event handlers only fire when Ctrl/Alt are being held down.

@victorhuangwq
Copy link
Collaborator

KeyDown / KeyUp only fires on accelerator keys, and shift and enter are not accelerator keys by themselves, so it does not get triggered.

The flag you are mentioned is indeed something that is trying to enable intercepting all keys, but that is currently experimental

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

No branches or pull requests

3 participants