-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add support for sending keyboard input to WebView2 - SendKeyEvent #3671
Comments
Hi @53b4, thanks for reaching out and right now we don't have an equivalent API for this, but we can take it as a feature request. Would you like to shed more light on why you need this - for example, what kind of app is this, and what use cases you are handling here to catch pressed keys? |
Hi, thank you for response. |
Thanks, I've added it to our feature backlog. Is this feature critical for your app? Any workaround available yet? |
Thanks; we are working to found out workaround; let you know results |
Sorry, I missed let you know. It is not critical. |
Sending keys to a page is something I'm missing too. Some input elements require "real events" to recognise the text value. In JavaScript the document.execommand method currently works but that was deprecated years ago. Other JavaScript events and event sequences to emulate key down and up are not reliable to work all the time. |
@darbid Thanks for the input. May you give some examples in your app's scenarios where input elements require real events to recognize the text value? |
This is not my app but an example of the input element. https://research.wolterskluwer-online.de/document/55f290ba-966d-3e48-b8c6-69b6b63b890a Do note if you inspect that example you can give the input element a value but it will not be recognised. |
I have the same issue and it seems a basic one really. We can tell WebView2 to listen for hotkeys to give us a chance to handle them, since we use them on our parent window, and when the browser has focus it would eat it up or handle it itself. So this direction is catered for with API. But parent window to WebView2. Simple example:
So we need a simple, uncomplicated way, when we use our Accelerator map and OnHotKey event, that we can just pass it, eg CTRL + U over to WebView2. I really don't want to mess with JavaScript and other event handlers for what sounds like a simple It is why it was a godsend to have the API implemented for us to decide to let WebView2 handle hotkeys or do custom action. I would really like to see this implemented. |
Hi,
From some reasons inside CoreWebView2.AddHostObjectToScript(....) method I need to catch pressed keys and programmatically send its to webview2. Previously, in Cefsharp I used : ChromiumWebBrowser.GetHost().SendKeyEvent() .
Do we have some equivalent in webview2 ? I tried to use JS script, but here is problem because Monaco Editor for some subpages is used.
Please help
Regards,
AB#45786265
The text was updated successfully, but these errors were encountered: