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

Document the "accept" parameter for DropZone #12420

Open
edhgoose opened this issue Jul 17, 2024 · 0 comments
Open

Document the "accept" parameter for DropZone #12420

edhgoose opened this issue Jul 17, 2024 · 0 comments
Labels
Bug Something is broken and not working as intended in the system. untriaged

Comments

@edhgoose
Copy link

edhgoose commented Jul 17, 2024

Summary

The DropZone component has an "accept" parameter, which as per https://polaris.shopify.com/components/selection-and-input/drop-zone#:~:text=string-,Allowed%20file%20types.,-type%3F, is:

accept?: string
Allowed file types.

It's not clear what this string should be. Is it , separated?

From viewing the code, it is indeed - but it would be nice to be able to tell that from the docs.

The code defines it here: https://github.com/Shopify/polaris/blob/main/polaris-react/src/components/DropZone/utils/index.ts#L33, as far as I can tell.

Furthermore, it seems strange that the accept function takes an array or string, but the fileAccepted function which calls it only allows string:

https://github.com/Shopify/polaris/blob/main/polaris-react/src/components/DropZone/utils/index.ts#L5

Expected behavior

The docs should clearly explain that the accept parameter is a comma separated list of accepted file types.

And/or, it should be extended to allow an array of file types.

Actual behavior

N/A

Steps to reproduce

N/A

Are you using React components?

Yes

Polaris version number

N/A

Browser

N/A

Device

N/A

@edhgoose edhgoose added Bug Something is broken and not working as intended in the system. untriaged labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken and not working as intended in the system. untriaged
Projects
None yet
Development

No branches or pull requests

1 participant