Eliminate the overlay popup in most cases for pick_file on Web#273
Merged
PolyMeilex merged 7 commits intoPolyMeilex:masterfrom Nov 18, 2025
Merged
Eliminate the overlay popup in most cases for pick_file on Web#273PolyMeilex merged 7 commits intoPolyMeilex:masterfrom
pick_file on Web#273PolyMeilex merged 7 commits intoPolyMeilex:masterfrom
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
Closed
|
Works on Ubuntu 25.10:
|
PolyMeilex
approved these changes
Nov 18, 2025
Owner
PolyMeilex
left a comment
There was a problem hiding this comment.
Cool to see this working without any hacks, I was not aware of UserActivation API.
Thanks!
Owner
|
GitHub is partially down atm, so I'll merge this tomorrow. |
Contributor
|
Wow, so happy this landed - thanks @kevinmehall ❤️ |
Contributor
|
Would love to have this released 🙏 |
Owner
|
Sure, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: