Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Input directive model sometimes isn't updated in IE when typing fast #16519

@jkopponen

Description

@jkopponen

I'm submitting a ...

  • bug report
    feature request
    other

Current behavior:
Sometimes input directives model (viewValue) is not updated when typing to input field.
Expected / new behavior:
viewValue and input value are same after typing.

Minimal reproduction of the problem with instructions:
Sometimes input directives model (viewValue) is not updated when typing to input field.
This occurs with fast typing and slow computer.

This happens because in IE, angular listens keydown -event and has timeout handling that skips new keystrokes if handling of previous keydown is ongoing.
And previous ongoing keydown handling reads old value of input because the value is not updated immediately when key is pressed down.

AngularJS version: 1.6.6

Browser: IE 11

Anything else:

Activity

gkalpak

gkalpak commented on Apr 4, 2018

@gkalpak
Member

A solution would be to actually defer the listener (right now it seems that we use a mix of throttling/deferring):

var deferListener = function(ev, input, origValue) {
if (!timeout) {
timeout = $browser.defer(function() {
timeout = null;
if (!input || input.value !== origValue) {
listener(ev);
}
});
}
};

I.e. we would cancel the pending timeout and set a new one each time.

As a result the model would be updated later if the user types too fast. If we consider this a problem, we could use proper deferring in addition to the current implementation.

added this to the Backlog milestone on Apr 4, 2018
changed the title [-]Input directive model isn't randomly updated in IE.[/-] [+]Input directive model sometimes isn't updated in IE when typing fast[/+] on Apr 5, 2018
self-assigned this
on May 3, 2018
jkopponen

jkopponen commented on Jan 4, 2019

@jkopponen
Author

Hi,
I am just wondering is there any progress with this issue?
This has been assigned over 6 months.

jbedard

jbedard commented on Jan 13, 2019

@jbedard
Collaborator

This most likely won't be fixed as the project is now in LTS mode and only serious/security issues will be fixed.

inad9300

inad9300 commented on Jan 23, 2019

@inad9300

How is a bug in a core functionality of AngularJS not serious? 😅 If I understand correctly, when this happens, users will see something on the screen different than the underlying value kept in JavaScript. If this is truly the case, I sure hope no one is using AngularJS for anything... serious.

petebacondarwin

petebacondarwin commented on Jan 23, 2019

@petebacondarwin
Contributor

AngularJS is a mature legacy project, which is no longer being actively developed. We instigated LTS mode last summer, to provide basic on-going support for 3 years. This includes fixing recent regressions (introduced by commits since 1.7.0), security concerns and catastrophic failures caused to by changes to things outside of our control (e.g. new releases of browsers or JQuery).

Although this is indeed a bug in the core, it is not a recent regression, and does not appear to affect a large number of projects. Moreover it only appears to impact apps running on a few legacy browsers.

Therefore it is not on our road map for fixing in a future release.

One of the benefits of AngularJS no longer receiving significant development, is that it is now much less risky to fork the project and fix bugs that are specific to your scenario. Previously this was not recommended as it would involve a significant effort to ensure that your fork was kept up to date with the main AngularJS project. Since LTS began there are very few changes to AngularJS and so forking the project is now a much more viable approach for bugs like this.

added a commit that references this issue on Apr 12, 2019
thejhh

thejhh commented on Apr 12, 2019

@thejhh

I made the fix in the above commit and also run tests with Travis-CI. However, I'm not sure how to make my own deployment package yet.

gkalpak

gkalpak commented on Apr 14, 2019

@gkalpak
Member

@jheusala, I am not sure what you mean by "make my own deployment package". If you are asking how to build AngularJS to generate production scripts (to include in your app) from your local copy of the repo, you find the commands here. (Hint: It's yarn grunt package 😉)

thejhh

thejhh commented on Apr 15, 2019

@thejhh

I have tested this fix and it makes input on IE much more responsive. It's still too early to tell if the problem with last character missing is fixed, but I have not seen that happen anymore.

If I would do a merge request, is there any chance this fix could be accepted to LTS? Sure, it's an EOL browser, but some of us still need to support it, and this is clearly a bug in AngularJS.

PS: I saw there was other places in the code using the same paradigm of ignoring event if timeout was already in place. My fix is precisely to this input event problem; there may be other bugs affected by the same paradigm.

thejhh

thejhh commented on Apr 15, 2019

@thejhh

AFAIK it also does not affect modern browsers, since this part of the code is in IE-only block. Unless there is other (legacy) browsers that use it; in that case, it would be a bug for them, too.

gkalpak

gkalpak commented on Apr 16, 2019

@gkalpak
Member

I'm afraid this won't happen, @jheusala. We are ourselves tempted to keep fixing stuff like this, but such bugs will always be around and we should stick to our LTS policy 🕴

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @petebacondarwin@jbedard@thejhh@inad9300@gkalpak

      Issue actions

        Input directive model sometimes isn't updated in IE when typing fast · Issue #16519 · angular/angular.js