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

Set initial directory to be opened with chooseFileSystemEntries #94

Closed
EricSimons opened this issue Sep 25, 2019 · 5 comments · Fixed by #287
Closed

Set initial directory to be opened with chooseFileSystemEntries #94

EricSimons opened this issue Sep 25, 2019 · 5 comments · Fixed by #287
Labels
feature - file picker Improvements to the file/directory picker
Milestone

Comments

@EricSimons
Copy link

Similar to #85, but instead I think that chooseFileSystemEntries should accept an optional file/dir handle that it will be initially opened to.

Passing a file/dir handle ensures the browser knows exactly which location to open w/ permissions (i.e. no string parsing/etc). Using handles makes a lot of sense, as the only time a web app should be instructing chooseFileSystemEntries to open a specific directory is when it already knows that directory exists (i.e. it has already received the handle in a previous call to chooseFileSystemEntries).

Besides the use cases mentioned in #85, this will enable file tree UIs (like the one we have on stackblitz.com) to include "create file / folder" buttons that open the picker in the desired directory the user clicked in.

IMO this is incredibly important (and the only omission I've found in this spec) for providing realistic filesystem UX.

@EricSimons EricSimons changed the title Set default directory to be opened with chooseFileSystemEntries Set initial directory to be opened with chooseFileSystemEntries Sep 26, 2019
@mathiasbynens
Copy link

+1 to this. My use case is an “installer”, which lets the user select a directory on their machine, to which the installer then writes a (large) number of files. The thing is, the desired location is always one of three paths, depending on the operating system (navigator.platform).

As a workaround, I currently note down these three locations, so that the user can copy-paste them into the directory picker manually… but most users probably won’t realize they can do that.

@mkruisselbrink
Copy link
Contributor

#261 has a proposal for an API for this, feedback welcome.

@EricSimons
Copy link
Author

@mkruisselbrink I just took a quick look and this proposal seems to cover the requested functionality quite well. I particularly like the ability to specify startInParentOf as well as startIn, as I can see cases where we'd want to start the picker in the parent directory for a given folder handle (but don't have a handle for the parent dir itself).

Great work to you & team! Happy to provide feedback on anything else if it'd be helpful. We're building around the Chrome FS API quite heavily for upcoming functionality on stackblitz :)

@mkruisselbrink
Copy link
Contributor

After some more internal discussion we're currently actually leaning towards not having separate startInParentOf and startIn options. Could you elaborate a bit more on what concrete use cases you see where starting the picker in the parent directory for a given folder handle would be important?

mkruisselbrink added a commit that referenced this issue Jan 22, 2021
mkruisselbrink added a commit that referenced this issue Jan 22, 2021
…#261)

* Add initial explainer for suggestedName, startIn and related options.

This describes a proposal for #85, #144, #94 amd #80.


Co-authored-by: a-sully <[email protected]>
Co-authored-by: Thomas Steiner <[email protected]>
github-actions bot added a commit that referenced this issue Jan 22, 2021
…related options. (#261)

* Add initial explainer for suggestedName, startIn and related options.

This describes a proposal for #85, #144, #94 amd #80.

Co-authored-by: a-sully <[email protected]>
Co-authored-by: Thomas Steiner <[email protected]>

SHA: 282dcba
Reason: push, by @mkruisselbrink

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@EricSimons
Copy link
Author

If a user is trying to open a new folder, I'd prefer to have filepicker start in the parent dir of a provided file handle because the user already granted permission to its existing directory (i.e. it wouldn't make sense for the user to choose a subfolder within that directory). Otherwise the user will have to manually back out at least one level to explore directories/folders that haven't already been granted.

mkruisselbrink added a commit that referenced this issue Jun 4, 2021
github-actions bot added a commit that referenced this issue Jun 4, 2021
…er methods. (#287)

This adds the options as described in https://github.com/WICG/file-system-access/blob/main/SuggestedNameAndDir.md.

Fixes #85, fixes #144, fixes #94 and fixes #80

Co-authored-by: Austin Sullivan <[email protected]>

SHA: 3309115
Reason: push, by @mkruisselbrink

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature - file picker Improvements to the file/directory picker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants