Yuvaleros/material-ui-dropzone

inputProps are not being respected

grahamlangford opened this issue · 2 comments

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

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

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)