Skip to content

[material-ui][TextField] Props passed in inputProps are not attached when slotProps.htmlInput is passed #44320

Closed
@sai6855

Description

@sai6855

Steps to reproduce

Link to live example: (required) https://stackblitz.com/edit/react-osybga?file=Demo.tsx

Steps:

  1. className is passed in inputProps and id is passed through slotProps.htmlInput
  2. On inspecting you can notice, className passed in inputProps didn't get attached and only id got attached
  3. Since inputProps is deprecated not removed, as a user i would expect old behavior would work as is, irrespective of whether slotProps is passed or not.

FYI: This PR actually solved this issue, we can consider merging it if we think this issue is a bug.

How to test changes changes are working in #43606

  1. open https://deploy-preview-43606--material-ui.netlify.app/material-ui/react-text-field/#basic-textfield demo
  2. paste code from above live example (I'm not able to create a sandbox from PR)
  3. Notice in html that both className and id got attached to input

Current behavior

props passed in inputProps not getting attached if slotProps.htmlInput is passed

Expected behavior

props passed in inputProps should get attched

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: TextField

Metadata

Metadata

Assignees

Labels

component: text fieldThis is the name of the generic UI component, not the React module!

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions