-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
WinForms - Opening file picker via <input type="file"> does not correctly restores focus after canceling/picking a file #4692
Comments
Likely the result of this upstream change. CEF switched to using |
I see. I wonder, how come I cant just work around this and do browser.Focus() on the Form.Activated event (which is correctly triggered when file browser is closed)? Why does the Focus() return false? Or even when it does returns true, it still does not focus on the browser control. What would be the proper way to focus on the browser manually? |
You'd have to debug to find that out.
|
Seems like there are multiple issues regarding that change. We have a DownloadHandler implemented, where we are specifying the download path manually and it is being ignored - the last path is always used for the dialog.
|
You can show your own custom dialog for downloading files and you should be able to do the same for the file picker as well. https://cefsharp.github.io/api/118.6.x/html/M_CefSharp_Handler_DialogHandler_OnFileDialog.htm |
Is there an existing issue for this?
CefSharp Version
120.2.70
Operating System
Windows 10
Architecture
x64
.Net Version
NET 4.7.2
Implementation
WinForms
Reproduction Steps
Repo (using MinimalExample): https://github.com/MaTToX3/cefsharp-winforms-focus-issue
When opening a file picker on a website via simple and picking a file/canceling it, the focus is not correctly restored to the browser component. How do I know: having a keyup event listener on that page the event is not triggered until website is manually clicked again.
Expected behavior
The focus should be correctly restored back to the browser component - e.g. keyup listener should be triggered if any key is pressed.
Actual behavior
Focus is not correctly restored until manually clicked.
Regression?
Issue exists since v102.0.90, the last version this works correctly is 101.0.180
Known Workarounds
No workaround found, I tried some options with manually focusing back to control but it did not work:
https://stackoverflow.com/questions/77865196/cefsharp-chromiumbrowser-looses-focus-when-opening-file-picker-via-input-type
Does this problem also occur in the CEF Sample Application
No, focus is correctly restored in a CEF Sample App (tried Winforms version).
Other information
No response
The text was updated successfully, but these errors were encountered: