Issue metadata
Sign in to add a comment
|
iOS Chrome: Autofill does not fire onChange, and .value property remains empty
Reported by
dominic....@gmail.com,
Feb 16 2018
|
||||||||||||||||||||||||
Issue descriptionSteps to reproduce the problem: 1. Autofill a form input (e.g. email) What is the expected behavior? 1. A change event is fired 2. The input element's .value property has the filled value What went wrong? 1. No change event 2. The value property of the node is empty (or doesn't update) Did this work before? N/A Does this work in other browsers? Yes Chrome version: 64.0.3282.112 Channel: stable OS Version: 11.2.5 Flash Version: This is really bad news for any modern web app which uses controlled components (i.e. listen to change events and passes the current value to the component). For example any React or Angular project. Safari has fixed this issue... yes, even Safari. I doubt that most modern web apps work with iOS Chrome when autofill is used, since as soon as the component re-renders the autofill value is lost, since the state of the component never got the change. Even hacky workarounds don't work, since the value property on the node doesn't get the new value either.
,
Feb 19 2018
,
Feb 22 2018
,
Mar 8 2018
Thanks for filing this Dominic. Could you provide an example where Chrome fails to autofill a form because of this? Also when you say "(e.g. email)" are you referring to a login form or an address form (e.g., in a checkout form when purchasing online)? I can confirm that Chrome does fire change events. However those events aren't trusted events due to limitation on the iOS platform (Safari doesn't have those limitations). An example would really help us debug this issue. dvadym@, does password manager use __gCrWeb.fill.setInputElementValue(...) for setting field values?
,
Mar 8 2018
Hi, thanks for taking a look at this. Whilst setting up a demo I realised something - this is actually working in iOS Chrome. Why this has caused a discussion in the React community (https://github.com/facebook/react/issues/1159) is that iOS Chrome behaves differently to Desktop Chrome and most other browsers. You can see the issue about that here: https://bugs.chromium.org/p/chromium/issues/detail?id=705275 I didn't realise that React onChange doesn't actually listed to the 'change' event! This has caused quite a lot of confusion. Why this works in other browsers is that they are firing focus, keydown, input, keyup, change and blur. I believe React is using the 'input' event for onChange for some reason. Please feel free to close this issue as the one linked above more accurately describes the issue. For your reference here is a demo of it working natively but not in React I set up: https://kind-stallman-f3c045.netlify.com/
,
Mar 8 2018
Thank you for the explanation Dominic. We did fix that behavior back in December. We now fire keydown, change, input, and keyup events. https://chromium-review.googlesource.com/c/chromium/src/+/771674 We also had a fix for React. https://chromium-review.googlesource.com/c/chromium/src/+/844324 while this does fix the autofill behavior, it still does not invoke the onChange handler.
,
Mar 9 2018
Thanks for clarifying this. We're experiencing the same issue on Google Chrome with Autofill using React. Great to hear that this has been fixed in Chromium. Is there a way to check when this fix will be available in Google Chrome? Thanks
,
Mar 9 2018
Chrome 64 (chrome://version) should have the fix.
,
Mar 9 2018
That's very strange because I am in fact on Chrome 64 for iOS and still experiencing the issue. When a form in React is populated by Chrome's Autofill feature neither onChange nor onInput will be called. On macOS Desktop (also Chrome 64) the problem does not appear. Also, on iOS Safari the issue does not exist.
,
Mar 9 2018
I just added the "input" event to the native part of the test here: https://kind-stallman-f3c045.netlify.com/ And can confirm on Chrome 64 on iOS it does not fire an "input" event, only a "change". Hence why it still doesn't work with React onChange!
,
Mar 9 2018
The reason is that React internally listens to the input event and maps that to the onChange event. I don't know why they do it but I think Chrome on iOS should fire an input event when Autofill is triggered.
,
Mar 9 2018
I understand but it doesn't, in the example linked the non-react inputs are listening for change and input, and only change is fired
,
Mar 9 2018
Chrome iOS does fire the input event. https://chromium-review.googlesource.com/c/chromium/src/+/771674/14/ios/web/web_state/js/resources/common.js I don't think the onChange event is broken because 'input' or 'change' events aren't fired. My suspicion is that React internally expects trusted events. Events created and fired in Javascript aren't trusted. Hence the events fired by Chrome iOS are ignored by React. I'm not familiar with React's implementation. If you are, could you please try to verify that?
,
Mar 9 2018
React was mounting on a different component, it's not react interfering with events - just to prove the case here is a version without any react or react libraries, purely native: https://kind-stallman-f3c045.netlify.com/native.html Despite what the code PR says, if you autofill that in iOS Chrome 64 it only receives the change event. Autofill it in Chrome Desktop or iOS Safari and it receives input, change, keyup and keydown. I can only surmise that the change isn't in iOS Chrome, or it isn't working! Here's a screenshot directly from my phone: https://i.imgur.com/yoPYcoe.png And here's one from desktop Chrome macOS also v64: https://i.imgur.com/bMIDvOi.png
,
Mar 9 2018
The fix isn't in Chrome 64. My bad. Chrome 65 will have (to be rolled out starting March 13th). I just tested your native events demo website and it works on Chrome 65. I appreciate you following up on this.
,
Mar 9 2018
Aha! Cool thanks for checking it out and being responsive, look forward to the fix.
,
Mar 9 2018
That‘s great news! Thanks a lot!
,
Jul 24
I am experiencing this issue on https://kind-stallman-f3c045.netlify.com/ with Chrome iOS 68.0.3440.70. This is the first time I have run into the bug so not sure if it is specific to that version of Chrome iOS.
,
Jul 24
I also have it in 67 but the strange thing is that now Chrome does fire an “input” event as you can see when auto filling the native inputs. I’m going to have a dig into React to see why it’s not picking up that input event since as far as I was aware it was listening for that in order to fire the onChange event. I do know that React attaches one handler on something top level like the document and catches the events bubbling up but need to investigate further as I don’t see why it wouldn’t catch that.
,
Yesterday
(26 hours ago)
Do we have an ETA when this can be fixed? The Chrome iOS users of my app experience input fields that are already filled (that's good) but error messages saying the same fields are empty (super bad!). It looks like my app is very buggy when it's in fact chrome iOS that dont trigger events like any other browser :( |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by tkent@chromium.org
, Feb 19 2018