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
Add directory support for FileTrigger #5444
Add directory support for FileTrigger #5444
Conversation
multiple={allowsMultiple} /> | ||
multiple={allowsMultiple} | ||
// @ts-expect-error | ||
webkitdirectory={UNSAFE_directory ? '' : undefined} /> |
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.
this implementation uses an empty string for the webkitdirectory attribute instead of a boolean value because it does not function correctly with boolean.
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.
Thanks for the PR!
@@ -120,6 +120,20 @@ A file trigger can accept multiple files by passsing the `allowsMultiple` proper | |||
</FileTrigger> | |||
``` | |||
|
|||
## Directory Selection | |||
|
|||
To enable selecting directories instead of files, use the `UNSAFE_directory` property. |
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.
Since it looks like this is well-supported with browsers we support, I think we can just use directory
.
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.
Fixed by the following commit.
|
||
To enable selecting directories instead of files, use the `UNSAFE_directory` property. | ||
|
||
This reflects the webkitdirectory HTML attribute and allows users to select directories and their contents. |
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.
Feel free to make webkitdirectory
link to https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
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.
Thanks for the comment. Link added.
refac: Remove unsafe prefix
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.
Thanks for the PR!
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.
GET_BUILD
GET_BUILD |
Build successful! 🎉 |
## API Changes
unknown top level export { type: 'any' } |
Updated section title to match formatting of others
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.
LGTM
Closes #4963
✅ Pull Request Checklist:
📝 Test Instructions:
Verified that only directories are selected when the UNSAFE_directory property is applied.
Added test to verify that the webkitdirectory property is applied.
🧢 Your Project: