text-mask icon indicating copy to clipboard operation
text-mask copied to clipboard

Discard invalid input props

Open Avasam opened this issue 4 years ago • 0 comments

(I was originally gonna post this on Material-UI, but realized this library is the cause)

Passing a custom component using MaskedInput to MUI's TextField's inputProps property seems to be passed all the way to the actual <input> element, which causes this error to appear in the console: index.js:1 Warning: React does not recognize the `inputComponent` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `inputcomponent` instead. If you accidentally passed it from a parent component, remove it from the DOM element.

  • [x] The issue is present in the latest release. (^5.4.7)
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

image

Expected Behavior 🤔

No errors as-is with Material-UI/text-mask, without having to resort to a workarounds such as { inputProps, ...props }: CustomProps. inputProps is specifically an issue here as it's used with MUI, but I believe the true solution is to discard all invalid input properties.

Steps to Reproduce 🕹

Use a MaskedInput with some inputProps

https://codesandbox.io/s/delicate-meadow-2j75c https://github.com/Avasam/speedrun.com_global_scoreboard_webapp/blob/develop/tournament-scheduler/src/Components/ScheduleManagement/ScheduleWizard/NonZeroNumberInput.tsx

Avasam avatar Jun 23 '21 19:06 Avasam