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

Input field model isn't updated after Alt Code sign in IE11 #14812

Open
SlippySken opened this issue Jun 21, 2016 · 4 comments
Open

Input field model isn't updated after Alt Code sign in IE11 #14812

SlippySken opened this issue Jun 21, 2016 · 4 comments

Comments

@SlippySken
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
If you use Alt Codes (don't know if they are called like that, but i mean pressing Alt on keyboard and then enter a number on the NumPad like so Alt + 789 is § or Alt + 1 is ☺) on an input field in IE11, then the model will be updated on lost focus or if you press backspace.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).
You can reproduce this behaviour on https://angularjs.org/ with the "The Basics" example. Enter some signs with Alt Codes (§§§) and then press backspace or click somewhere else. The model is updated after losing focus or pressing backspace and the text says "Hello §§§!"

What is the expected behavior?
In Firefox and Chrome the text ("Hello... !") changes immediately after entering only one sign and without you have to lose the focus.

What is the motivation / use case for changing the behavior?
It's an inconsistent behaviour between the browsers

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Tried with the current example on the https://angularjs.org/ webpage

Other information (e.g. stacktraces, related issues, suggestions how to fix)
I heard from other problems with the IE11 and events, maybe this is the same error. Don't know if angularjs can do something about this.

@gkalpak
Copy link
Member

gkalpak commented Jun 23, 2016

This happens, because on IEs we are not listening for (and responding to) the input event. Instead we listen for change (as we do in all browsers), but it will only fire after the field loses focus, and we also listen on keydown.

The problem is that the value is inserted only after releasing Alt, so on keyup (which we don't listen for).

To work around this, you can bind the element's keyup event and trigger a keydown for example (on IEs only).

Given that this is a rare usecase and that we are already going too far for working around the broken behavior of IE events, I'm not too keen on fixing this.

@Narretz
Copy link
Contributor

Narretz commented Jun 24, 2016

I really wish we could use input on IE, and deal with false positives rather than false negatives.

Note: this change was made in #9265

Afaict, the only problem is the input event when a placeholder changes. This happens when the actual placeholder text changes, but also when you focus the input (which causes the placeholder to disappear, i.e. change)

@gkalpak
Copy link
Member

gkalpak commented Jun 24, 2016

I really wish we could use input on IE, and deal with false positives rather than false negatives.

My too 😃 Or if older IEs (e.g. 9, 10?) are totally, broken, maybe we could still use input on newer versions (even if some patching/work-arounds were still necessary).

Do we have a concrete list of issues with input event on IEs? I remember there was an issue with input being triggered incorrectly when the placeholder changed (and not the input), but I doubt it is just that.

@SlippySken
Copy link
Author

SlippySken commented Jun 24, 2016

Hey there, thank you for the answers. Maybe I will try these workaround.
I can see a similar behaviour in another library with the IE.
esvit/ng-table#823
Maybe it's related to this problem?

I have tried it on the same first example of the angularjs site in IE. Enter the name "Test" in the field and then click the little "x" to remove the input. The input field is now emtpy but the text says "Hello Test!".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants