Stop syncing value attribute for controlled inputs
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 251k
- Forks
- 51.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 53
Description
Opening this as a follow up to some quick discussions in https://github.com/facebook/react/issues/11881. Syncing the value attribute has been a consistent source of bugs for us, and the benefits of doing so seem minimal. There's some previous discussion on the topic in https://github.com/facebook/react/pull/7359 and in other issues, I can't remember right now 😄
This would be a breaking change, so it would have to be done in a major release.
Reasons to keep syncing
- It prevents
form.reset()from putting controlled form inputs into a weird state - Some browser extensions (not sure which) read from the
valueattribute in some cases (not sure which) - It can be useful for querying inputs with a specific value using an attribute selector
Reasons to stop syncing
- It will reduce the complexity of
react-domin a non-trivial way - In turn, it will likely reduce bundle size as well
- We remove a whole class of bugs (fighting with browsers that want to be helpful about input values)
- Syncing the input value to the attribute potentially exposes sensitive data to third party tools (1)
What do we think? Are these reasons good enough to keep syncing the value attribute? Are there other more critical reasons we should keep doing so?
cc @nhunzaker @jquense @gaearon
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the discussion in issue #11881 and the previous discussion in pull request #7359, then examine how controlled inputs are handled in react-dom. The work is not yet defined: completion would require a decided approach to stopping value-attribute syncing and agreement on the breaking-change implications for a major release.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100