New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onChange handler not triggered by Safari's auto fill #2125

Closed
martijnrusschen opened this Issue Sep 1, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@martijnrusschen

martijnrusschen commented Sep 1, 2014

I have some trouble with a controlled React component that handles my sign in forms. The user input is controlled with a state which will be posted with an ajax request after submitting the form. The state of the username and password are being updated with a onChange event on both input fields.

When using Safari’s autofill functionality this onChange event isn’t triggered. For example, when typing a and clicking the auto fill suggestion, the value will be updated in the input field with the correct suggestion but the state isn’t updated.

I’ve added a Proof of Concept to try it yourself: http://jsfiddle.net/zcz1p35n/4/

Steps to reproduce:

  1. Go to http://jsfiddle.net/zcz1p35n/4/ in Safari
  2. Fill in the form with username: example@example.org - password: example
  3. Click on the sign in button
  4. Safari will ask you if you want to save your login details. Click ‘Save password’
  5. Go again to http://jsfiddle.net/zcz1p35n/4/
  6. Type e, this will trigger Safari’s autofill
  7. Click on the first suggestion
  8. The input field will contain the correct sign in details, but the state isn’t updated
@taddei

This comment has been minimized.

@zpao

This comment has been minimized.

Member

zpao commented Sep 1, 2014

Thanks for filing. This is unfortunately because Safari doesn't seem to fire any events when it does this. There's a bit more info in the stackoverflow link in #1159 (of which, I think we should just call this a dupe)

@sanntanna

This comment has been minimized.

sanntanna commented Oct 8, 2018

wrapping elements in <form> do cause autocomplete to emit an onChange event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment