mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.96k stars 32.27k forks source link

[TextField] Uncontrolled Input components do not fully reset when inside a `<form>` with a reset button #39302

Open Heet-Bhalodiya opened 1 year ago

Heet-Bhalodiya commented 1 year ago

Duplicates

Latest version

Steps to reproduce 🕹

Link to live example without using state: https://codesandbox.io/s/admiring-ishizaka-yjy2wk?file=/Demo.tsx

Link to live example using state: https://codesandbox.io/s/charming-grothendieck-r9zw8y?file=/Demo.tsx

Current behavior 😯

When I use certain components like radio buttons, checkbox, switch, textfiled, select, and autocomplete, I can't clear the value by pressing the reset button. When I click the reset button, the text inside the textfield gets cleared, but it will not shrink off the label.

If I use the above components with states then it will work properly (refer second codesandbox example above).

Expected behavior 🤔

Changes in the value of the above components will get reset while clicking on the reset button when we are not using the state (for the first codesandbox).

Context 🔦

No response

Your environment 🌎

npx @mui/envinfo ``` System: OS: macOS 13.2.1 Binaries: Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.17.1/bin/yarn npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm Browsers: Chrome: 116.0.5845.187 Edge: Not Found Safari: 16.3 npmPackages: @emotion/react: ^11.10.8 => 11.10.8 @emotion/styled: ^11.10.8 => 11.10.8 @mui/base: 5.0.0-alpha.127 @mui/core-downloads-tracker: 5.12.2 @mui/lab: ^5.0.0-alpha.128 => 5.0.0-alpha.128 @mui/material: ^5.12.2 => 5.12.2 @mui/private-theming: 5.12.0 @mui/styled-engine: 5.12.0 @mui/system: ^5.12.1 => 5.12.1 @mui/types: 7.2.4 @mui/utils: 5.12.0 @mui/x-data-grid: 6.0.3 => 6.0.3 @types/react: ^18.2.0 => 18.2.0 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.0.4 => 5.0.4 ```
poojadosad commented 1 year ago

Hello @mj12albert,

I am having the same issue. Any update regarding this issue?

mj12albert commented 1 year ago

Please open separate issues for each component 🙏

Heet-Bhalodiya commented 1 year ago

Hi @mj12albert,

You have already mention this issue in #38374 for the TextField then also I have to create separate issue for all other components?