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

open os file picker directly on pickfile in wasm #128

Open
JustFrederik opened this issue Aug 1, 2023 · 2 comments
Open

open os file picker directly on pickfile in wasm #128

JustFrederik opened this issue Aug 1, 2023 · 2 comments

Comments

@JustFrederik
Copy link

JustFrederik commented Aug 1, 2023

When using pickfile it creates html code like this:

<div id="rfd-card"><input id="rfd-input" type="file" accept=""><button id="rfd-button">Ok</button></div>

Coud you add an option like set_overlay to AsyncFileDialog which lets you skip this rfd-card and open the os file picker directly? The easiest solution would probably be to add an eventlistener to input instead of button.set_onclick(Some(closure.as_ref().unchecked_ref())); in wasm.rs:94 and add the visibility of the body.

@JustFrederik
Copy link
Author

@jprochazk
Copy link

jprochazk commented Aug 13, 2024

It seems like the FileSystem APIs are available on all browsers now: https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle

But the APIs required to create handles to files on the user's machine (showDirectoryPicker, showOpenDirectoryPicker, showSaveFilePicker) are Chromium-only.
That being said, they are significantly simpler than the existing approach, and they do provide a much better experience, requiring no extra dialog to make them work. Maybe rfd could use those APIs if they are available, and fallback to the current implementation if not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants