-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Input directive model sometimes isn't updated in IE when typing fast #16519
Comments
A solution would be to actually defer the listener (right now it seems that we use a mix of throttling/deferring): angular.js/src/ng/directive/input.js Lines 1325 to 1334 in b7d396b
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. |
Hi, |
This most likely won't be fixed as the project is now in LTS mode and only serious/security issues will be fixed. |
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. |
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. |
This fixes the IE issue reported to AngularJS at angular#16519 Instead of ignoring key events, we cancel the previous deferred timeout and declare a new one each time. This fixes the problem that references to `input` and `origValue` inside the deferred function do not point to the most recent key event occurrence.
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. |
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. |
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. |
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 🕴 |
I'm submitting a ...
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:
The text was updated successfully, but these errors were encountered: