Skip to content

Upgrading from React 14 to 15 breaks IE11 autofill behavior with controlled inputs #6614

Closed

Description

@jimbolla

I have a sign in form with controlled inputs that works fine using React 14. When I upgrade to React 15, autofill behavior in IE11 no longer triggers onChange. Strangely, if I change document mode from "Edge (Default)" to "10" React 15 still behaves as expected.

Reading the changelog for R15, this change sounds like it could be related:

Input events are handled more reliably in IE 10 and IE 11; spurious events no longer fire when using a placeholder.
@jquense in #4051

Activity

  1. jimbolla commented on Apr 27, 2016

    @jimbolla
    Author

    Here's a gist to repro the bug

    Steps:

    1. Download .zip and extract
    2. npm install
    3. node_modules\.bin\webpack
    4. node server.js
    5. Open IE11, goto http://localhost:8081/test.html
    6. Enter any username and password and submit the form. (Notice how the state gets updated while typing.)
    7. Click "Yes" to IE's "Would you like to store your password"
    8. Reload the page ( CTRL+R )
    9. Double-click the username textbox and select the username your entered. Notice the state does NOT get updated as expected.

    This is currently blocking us from upgrading to React 15, as most of our users are on IE11 and expect autofill to work.

  2. jquense commented on Apr 27, 2016

    @jquense
    Contributor

    I am not sure how the change would affect this. It only keeps changes for the same value from firing more than once. Does IE not fire a native onChange event here? If if does and the value is different it should work. I am wondering if this is still present in master with #5746 which changes the strategy a bit.

  3. jimbolla commented on Apr 27, 2016

    @jimbolla
    Author

    IE does not fire onChange on autofill. Supposedly, Safari has similar issues. There's some details in #1159

  4. jquense commented on Apr 27, 2016

    @jquense
    Contributor

    does it fire onInput? how can we know when it happens?

  5. jimbolla commented on Apr 27, 2016

    @jimbolla
    Author

    I'm not sure. It works in React 0.14.8, but not 15.0.1. So something changed in that release that broke IE. Based on the changelog, #4051 seems to be the likely culprit.

  6. jquense commented on Apr 27, 2016

    @jquense
    Contributor

    seems like the different then is that IE10 fires onChange for autofill whereas IE11 does not :/

  7. arendjr commented on May 11, 2016

    @arendjr

    @jimfb: Could it be this issue is also related to #6406?

  8. jimfb commented on May 11, 2016

    @jimfb
    Contributor

    @arendjr No, I don't think so. #6406 has nothing to do with events.

  9. arendjr commented on May 11, 2016

    @arendjr

    Okay thanks, then I'll try to dig a bit deeper to see if I can track this down.

  10. arendjr commented on May 11, 2016

    @arendjr

    Okay, can confirm that by reverting #4051 auto-fill issues get fixed for me in IE11.

    But that PR was merged to resolve #3826... so what would be the proper way forward here?

  11. jimfb commented on May 11, 2016

    @jimfb
    Contributor

    @arendjr Presumably autofill fires some sort of DOM event. When that event fires with the new value, we should fire an onChange event. So the proper path forward is to figure out which event we should be listening to, and add the logic to ensure an onChange fires.

  12. arendjr commented on May 17, 2016

    @arendjr

    @jimfb: Yes, it does, it fires both "input" and "change" events in this case. The problem is, it doesn't fire the "propertychange" event React listens to.

    If you want to know more about which events IE fires, see: https://msdn.microsoft.com/en-us/library/dn629640(v=vs.85).aspx
    I have confirmed myself also the tables on that page are correct; so for an auto-fill "input" and "change" fire, but "propertychange" doesn't.

    The thing is, except for some specific input types, React never listens to the "change" event, and because of #4051, it doesn't listen to the "input" event anymore either for IE. I've tried to dig into how to fix it, but the conclusion I keep coming back to is that #4051 should be reverted, and #3826 should be applied in its stead.

    Maybe I should just create a new PR that does exactly that :)

  13. 8 remaining items

  14. jimbolla commented on May 29, 2016

    @jimbolla
    Author

    I've started looking into which events do or don't fire on autofill, but reconciling that with React's source is nontrivial. I'm trying to follow the progress @arendjr has made with identifying specific commits related to the issue.

    For anyone that needs access to IE11 for testing purposes, you can download a Windows VM from Microsoft.

  15. jquense commented on May 29, 2016

    @jquense
    Contributor

    getting react to listen on specific events in this case should be trivial (provided you know what you are looking at which I admit is not obvious). I don't mind working on it but I won't have access to ie11 still Wednesday or so

  16. jimbolla commented on Jun 6, 2016

    @jimbolla
    Author

    @jquense It seems to work fine for the username, but when the password field goes through getTargetInstForInputEventIE for topChange, the activeElement variable is null. I can see the node in targetInst._nativeNode though.

    Looks like currently activeElement is only set when the field receives focus. That's won't work for the password field which never fires the focus event.

    IE AutoComplete event handling

  17. jimbolla commented on Jul 2, 2016

    @jimbolla
    Author

    Are the changes in master that should fix this included in the new React 15.2.0 build?

  18. sophiebits commented on Aug 2, 2016

    @sophiebits
    Contributor

    Probably not, sorry. Still need to find and ship a fix.

  19. jquense commented on Aug 2, 2016

    @jquense
    Contributor

    afaict the simplest fixes are: revert my earlier PR or backport my better one :P

    I've looking at the existing code and to my mind the current polyfill approach just won't work with ie11 well. Tbh this issue has probably been present for ie8-9 but the lack usage (or features like autofill) means less folks are likely to notice

  20. jquense commented on Aug 2, 2016

    @jquense
    Contributor

    and fwiw the changes in master could be back ported without breaking changes if folks wanted to (as I've noted on other such issues). @jimfb can feel free to ping me about it if anyone is interested in that approach

  21. special-character commented on Dec 1, 2016

    @special-character

    Are there any updates on when this might be fixed?

  22. added a commit that references this issue on Dec 14, 2016
    ff73f69
  23. simonvizzini commented on Mar 30, 2017

    @simonvizzini

    Any updates on this issue? I just implemented some controlled inputs/forms and this was instantly the first defect QA has reported 😞 Is there maybe a workaround I could implement in our code? Unfortunately, IE10+ is the main browser our customers use and without proper autocomplete support I might have to revert all React based forms to something else, creating some kind of frankenstein monster (React components rendering non-React forms)

  24. special-character commented on Mar 30, 2017

    @special-character

    @simonvizzini I ran into a problem when running selenium tests where the test would type into the search box, but the onChange event was not triggered in React. If this is the same problem your QA is experiencing, my hack was to add an onKeyUp listener to the input so the selenium test could correctly insert text into it.

  25. added a commit that references this issue on May 20, 2017
    68347c9
  26. added a commit that references this issue on Jun 7, 2017
    f82d323
  27. flarnie commented on Jun 13, 2017

    @flarnie
    Contributor

    This should be fixed in v15.6.0, which was just released today. Please reopen or open a new issue referencing this one if it still is an issue.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions