javascript - Empty password input value on autocomplete (React.js) -
after login form autocompleted browser, queried password input's value empty. after click password field, value gets magically available, there many events fired browser don't make sense. (the onchange
on password input not among them.)
- why value on
input[type=password]
empty?- why autocomplete on password input doesn't fire
onchange
event?
( fires on normal input )- bonus question: why there second (unnecessary) focus/blur event?
1. both inputs set type="text"
- both inputs rendered once (no autocomplete)
note: inputs uncontrolled stateful , track state changes on focus, blur, change
entered=true
when there value enteredfocused=true
whenonfocus
fired,=false
whenonblur
firedpeek=true
when need programatically forcetype
password
totext
2. input set type="password"
(see how form autocompleted.)
- ...
- 2.render (red arrow) - browser focused input
onchange
fired on email input- 3.render - internal state changed (
entered=true
) - 4.render - browser unfocused input
- 5.render (yellow arrow) - browser focused input again?
6.render - browser unfocused input
browser didn't make changes dom element
preview password - changed input type
text
programatically- manual validateform() - password empty, form invalid
- manual interaction says value
""
empty
what interesting after pressing prtscr in browser, value gets available , form gets rerendered - when focusing input hand.
Comments
Post a Comment