After my login form is autocompleted by the browser, the queried password input's value is empty. After I click into the password field, the value gets magically available, also there are many events fired by the browser that don't make sense. (The onChange on password input is not among them.)
- Why is the value on
input[type=password]empty?- Why the autocomplete on password input doesn't fire
onChangeevent?
( it fires on normal input )- Bonus question: Why there is the second (unnecessary) focus/blur event?
1. Both inputs set to type="text"
- Both inputs get rendered once (no autocomplete)
note: My inputs are uncontrolled but stateful and I track state changes on focus, blur, change
entered=truewhen there is a value enteredfocused=truewhenonFocusfired,=falsewhenonBlurfiredpeek=truewhen I need to programatically forcetypefrompasswordtotext
2. Input set to type="password"
(See how the form is autocompleted.)
...
2.render (red arrow) - Browser focused the input
onChangefired on email input3.render - Internal state changed (
entered=true)4.render - Browser unfocused the input
5.render (yellow arrow) - Browser focused the input again?
6.render - Browser unfocused the input
Browser didn't make any changes to dom element
preview password - changed input type to
textprogramaticallymanual validateForm() - password is empty, form is invalid
manual interaction also says the value is
""empty
What is interesting is that after pressing the PrtScr in the browser, the value gets available and form gets rerendered - as when focusing the input by hand.


