3 ms·
For those that are confused, updating the property would mean: this.input.value = 'password'; This would be fine. However updating the attribute (the way R
by poxrud 9y ago
For those that are confused, updating the property would mean:
this.input.value = 'password';
This would be fine. However updating the attribute (the way React recommends it with controlled components) would be something like:
<input type="text" value={this.state.value} onChange={this.handleChange} />
This would be vulnerable to the the CSS keylogger.
- Cyranix 9y agoI believe using `defaultValue` instead of `value` would be an appropriate remediation.
- elliotec 9y agoDo you mind expanding on this a little? Or linking to a documentation or something
- deleted 9y ago[deleted]
- dimgl 9y agoThat being said, you might be thinking about this incorrectly if you're doing this. You can use a form and grab the values on submission. <form onSubmit={this.handleSubmission}> <input type="password" name="password" /> </form> this.handleSubmission = event => { // access to event.target.password.value }
- baddox 9y agoYou still lose things like validation on blur and displaying real-time password strength.
- always_good 9y agoIt might be a fair workaround, but it sucks to regress to storing truth in the DOM.