mui / mui/material-ui

[Select] Doesn't reset value after clicking Clear form by using autofill values by the browser

Open
#31,426 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scope: select type: bug
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
Current behavior 😯

I've been struggling with a strange behavior that I think is more like a bug of the Select component itself. I just want to make sure that I'm not doing anything wrong or am not missing some properties to set.

Okay the thing is, I'm using material ui and when I use the autofill feature provided by the browser everything seem to work fine. But when clearing the form the Select value is not resetting to the default one. This behavior only happens with the Select component, if a use the select on native mode works fine but I want to use the mui Select.

This is what is happening now

https://user-images.githubusercontent.com/31553757/157980857-eb4ecfb9-f2d4-4fd8-992a-dfe815028fe4.mov

Expected behavior 🤔

Being able to use the autofill feature and clear the form including the select component

https://user-images.githubusercontent.com/31553757/157980265-92ec94e2-17c3-4fee-b1e0-7eb74e0a68f7.mov

Steps to reproduce 🕹

Use this link to follow the steps

Steps:

  1. Fill up all the information and chose a different value from Select component) and click submit, then reload the sandbox and you will be able to see the autofill option when focusing an input.

image

  1. next, When I click on Clear form

image

All the values are being reseted except the value in the select component.
image

Context 🔦

No response

Your environment 🌎

No response

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 reproduction in the linked CodeSandbox, specifically /src/App.js, and compare the MUI Select with its native mode while using browser autofill and Clear form. Trace how the Select value responds to the form reset; done means autofilled values, including the Select, return to the default state after clearing.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.