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

inputProps are not being respected #235

Closed
grahamlangford opened this issue Aug 12, 2020 · 2 comments · Fixed by #239
Closed

inputProps are not being respected #235

grahamlangford opened this issue Aug 12, 2020 · 2 comments · Fixed by #239
Labels
Milestone

Comments

@grahamlangford
Copy link

Bug Report

Describe the bug

I'm trying to apply a data-testid prop to the native input using the inputProps prop of DropzoneArea, but the prop is lost before reaching the input. React Devtools shows that DropzoneArea has the correct prop, but Dropzone isn't receiving it.

I looked at DropzoneAreaBase, and inputProps is spread to the input before getInputProps. The react-dropzone docs state:

Note that whatever other props you want to add to the element where the props from getRootProps() are set, you should always pass them through that function rather than applying them on the element itself. This is in order to avoid your props being overridden (or overriding the props returned by getRootProps()):

Steps to reproduce

  • Implement a DropzoneArea, passing props to the native input using the inputProps prop.
  • Inspect the input element
  • Validate that the input does not contain the expected props

Expected behavior

  • The native input should have the expected props

Versions

  • OS: [e.g. iOS]
  • Browser: [e.g. chrome, safari]
  • @material-ui/core version: [e.g. 4.9.2]
  • material-ui-dropzone version: [e.g. 3.0.1]

Additional context

@panz3r panz3r added the bug label Aug 18, 2020
@panz3r panz3r modified the milestones: 4.x, 3.4.1 Aug 18, 2020
panz3r pushed a commit that referenced this issue Aug 18, 2020
panz3r pushed a commit that referenced this issue Aug 18, 2020
@cadrimiranda
Copy link

Hello, how it's going on this bug? Can I help?

@panz3r
Copy link
Contributor

panz3r commented Aug 24, 2020

Hi @grahamlangford and @cadrimiranda ,

Thanks for your feedback, the fix to this issue is included as of version 3.4.1 of the module which is not yet been published to npm.

In the meanwhile to install the latest version you can use

❯ npm i yuvaleros/material-ui-dropzone#v3.4.1

(the same also works with yarn)

rtritto pushed a commit to rtritto/material-ui-dropzone-2 that referenced this issue Jun 6, 2021
rtritto pushed a commit to rtritto/material-ui-dropzone-2 that referenced this issue Jun 8, 2021
rtritto pushed a commit to rtritto/material-ui-dropzone-2 that referenced this issue Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants