Skip to content

Stop syncing value attribute for controlled inputs #11896

Open
@aweary

Description

@aweary

Opening this as a follow up to some quick discussions in #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 #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 value attribute 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-dom in 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions