-
Notifications
You must be signed in to change notification settings - Fork 95
Eliminate the overlay popup in most cases for pick_file on Web
#273
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
Conversation
…completed or cancelled
…omatically click it
The web_sys types only exist on wasm, so the whole example will not work on other targets
…out transient user activation
|
Works on Ubuntu 25.10:
|
PolyMeilex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool to see this working without any hacks, I was not aware of UserActivation API.
Thanks!
|
GitHub is partially down atm, so I'll merge this tomorrow. |
|
Wow, so happy this landed - thanks @kevinmehall ❤️ |
|
Would love to have this released 🙏 |
|
Sure, |
Fixes #128 - The wasm implementation of
rfdcurrently requires a few extra clicks in an ugly popup, but this can be avoided with browser APIs that have now been widely deployed for a couple of years.Use the change and cancel events on the
<input>to automatically dismiss the overlay and complete theFuturewhen the native file picker dialog is completed or cancelled.Combined with the existing call to
click()to automatically open the native dialog, this means the user doesn't have to see or interact with the popup at all.However, on some platforms like iPad where the native dialog doesn't cover the
rfdpopup, the existing behavior shows both, which is confusing:The
click()method is only effective when the app has transient user activation, which is going to be the vast majority of the time, but I wanted to leave the popup to handle any remaining cases. This detects whether we have transient user activation, and hides the popup if so.This touches
pick_fileand related only.save_filecould perhapsclick()the link, but I'll leave that for another PR.This PR also cleans up the web-trunk example and extends it to be able to test this code.
Tested on
Test steps
web-trunkexample: