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

[base-ui][material-ui] Uncontrolled Switch component do not fully reset when inside a <form> with a reset button #40245

Open
2 tasks done
aayush-makwana opened this issue Dec 19, 2023 · 1 comment
Assignees
Labels
component: switch This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: base-ui Specific to @mui/base package: material-ui Specific to @mui/material

Comments

@aayush-makwana
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example without using state: https://codesandbox.io/p/sandbox/eager-rgb-m43d9q

Link to live example using state: https://codesandbox.io/p/sandbox/focused-hellman-z83g9c

Current behavior 😯

When using Switch component, Pressing the reset button in a form does not revert value of the Switch to its default value.

If I use Switch with state then it will work properly.

Expected behavior 🤔

Changes in the value of the Switch 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: Windows 10 10.0.19045
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Chromium (120.0.2210.77)
  npmPackages:
    @emotion/react: ^11.11.1 => 11.11.1
    @emotion/styled: ^11.11.0 => 11.11.0
    @mui/base:  5.0.0-beta.28
    @mui/core-downloads-tracker:  5.15.1
    @mui/material: ^5.15.1 => 5.15.1
    @mui/private-theming:  5.15.1
    @mui/styled-engine:  5.15.1
    @mui/system:  5.15.1
    @mui/types:  7.2.11
    @mui/utils:  5.15.1
    @types/react: ^18.2.45 => 18.2.45
    react: ^18.2.0 => 18.2.0
    react-dom: ^18.2.0 => 18.2.0
    typescript: ^4.9.5 => 4.9.5
@aayush-makwana aayush-makwana added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 19, 2023
@zannager zannager added the component: switch This is the name of the generic UI component, not the React module! label Dec 19, 2023
@danilo-leal danilo-leal changed the title Uncontrolled Switch component do not fully reset when inside a <form> with a reset button [material-ui] Uncontrolled Switch component do not fully reset when inside a <form> with a reset button Dec 25, 2023
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Dec 25, 2023
@DiegoAndai DiegoAndai added package: base-ui Specific to @mui/base enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 5, 2024
@DiegoAndai DiegoAndai changed the title [material-ui] Uncontrolled Switch component do not fully reset when inside a <form> with a reset button [base-ui][material-ui] Uncontrolled Switch component do not fully reset when inside a <form> with a reset button Feb 5, 2024
@DiegoAndai
Copy link
Member

This should be supported in Base UI, getting it in Material UI after refactoring to use Base UI's Switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: switch This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: base-ui Specific to @mui/base package: material-ui Specific to @mui/material
Projects
None yet
Development

No branches or pull requests

5 participants