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)

console1

note: inputs uncontrolled stateful , track state changes on focus, blur, change

  • entered=true when there value entered
  • focused=true when onfocus fired, =false when onblur fired
  • peek=true when need programatically force type password to text

2. input set type="password"

(see how form autocompleted.)

form

console2

  • ...
  • 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

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -