Stop syncing value attribute for controlled inputs
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 251k
- Fork
- 51.4k
- Merge medio
- 2g 4h
- PR unite (30g)
- 53
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando la discussione nell’issue #11881 e la discussione precedente nella pull request #7359, quindi analizza come vengono gestiti gli input controllati in react-dom. Il lavoro non è ancora definito: per completarlo sarebbe necessario decidere un approccio per interrompere la sincronizzazione dell’attributo value e raggiungere un accordo sulle implicazioni del breaking change per una major release.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react
- Ambito
- frontend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100