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

Add directory support for FileTrigger #5444

Merged
merged 6 commits into from Nov 21, 2023

Conversation

ryo-manba
Copy link
Contributor

@ryo-manba ryo-manba commented Nov 20, 2023

Closes #4963

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 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:

multiple={allowsMultiple} />
multiple={allowsMultiple}
// @ts-expect-error
webkitdirectory={UNSAFE_directory ? '' : undefined} />
Copy link
Contributor Author

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.

ref: facebook/react#3468 (comment)

Copy link
Member

@reidbarber reidbarber left a 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.
Copy link
Member

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.

Copy link
Contributor Author

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.

refac: Remove unsafe prefix


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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

yihuiliao
yihuiliao previously approved these changes Nov 21, 2023
Copy link
Collaborator

@yihuiliao yihuiliao left a 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!

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GET_BUILD

@reidbarber
Copy link
Member

GET_BUILD

@rspbot
Copy link

rspbot commented Nov 21, 2023

@rspbot
Copy link

rspbot commented Nov 21, 2023

## API Changes

unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }

Updated section title to match formatting of others
Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yihuiliao yihuiliao merged commit a3d77ab into adobe:main Nov 21, 2023
26 checks passed
@ryo-manba ryo-manba deleted the feat/directory-support-file-trigger branch January 5, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add directory support for FileTrigger
5 participants