mui / mui/material-ui

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

Open
#40,244 1 comment 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package: @mui/base scope: checkbox type: enhancement
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

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/serene-shockley-l3yxnn

Link to live example using state: https://codesandbox.io/p/sandbox/sharp-hamilton-8385kw

Current behavior 😯

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

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

Expected behavior 🤔

Changes in the value of the Checkbox 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the two linked CodeSandbox reproductions, comparing the uncontrolled Checkbox example with the stateful example and the form reset action. Trace the Checkbox behavior involved in the reset event; done means an uncontrolled Checkbox returns to its default value when the form reset button is clicked.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.