-
Notifications
You must be signed in to change notification settings - Fork 27.4k
In IE, tabbing through a field sets it as dirty #1206
Comments
I think the problem is actually on https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L402 where it compares new vs. old values. It is comparing null vs. ''. It should normalize null to ''. |
@davispw I disagree. That line is within the event handler and is run by all browsers, so if that was the problem it would affect all browsers. Pressing the tab key should not even trigger the The line I referred to has since moved because of subsequent updates, it is the following line: https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L421 |
Is this issue resolved now? Can it be closed? |
@jbdutton I don't think it was fixed yet. But it is a low-hanging fruit so if anyone is up to preparing a pull request it would be surely accepted! |
I'll try to give it a shot this weekend. |
Thanks for the PR @jbdutton but as you say in your comment the problem is that there are a lot of keys that are still going to trigger the field being made dirty and it would be a lengthy bit of code to check for all of them. That's part of the reason why I myself hadn't submitted a PR, the other being at the time I logged the issue it was difficult to build Angular on Windows. I wondered if a solution would be to add the I also wondered whether the |
It seems reasonable... we're basically white listing what keys can affect an input. And you're right, I don't see any point to the |
Change event is needed for browsers that do not support I found also a bug in $sniffer service that will prevent Angular from detecting
The problem is, that Opera Classic will have
This is not true, |
Thanks @montgomery1944 for your input (no pun intended). Am I right in thinking that what we might be looking at is:
The Is that right? |
Hopefully this hasn't already been addressed, but I found that changing this line:
To:
Or whatever way you want to detect IE browsers, fixed this problem. |
The last post of morrisjn seems to be a solution to the problem. |
The reason it fixes the problem is that IE sends input events for completely silly reasons. I've actually filed a bug with them about it, since they're still doing it in IE11. Hopefully that will eventually be fixed. I think it might not be a bad idea to just not listen to the input event for IE at all, though, and it would mean we could throw away my lame hack around the placeholder issue. Have a go at implementing it |
+1 In IE11, just clicking on the field sets it as dirty. |
@seaside98 there's no way for us to fix this in angular... As a workaround, you can avoid using a placeholder... It's stupid, but that will do it... I filed an issue on MS's feedback thingy --- you can +1 it or whatever, but yeah basically IE is doing the wrong thing, and they've triaged it as a pretty low priority, so you might not see a fix until IE12 or even later. The issue I've filed is at https://connect.microsoft.com/IE/feedback/details/856700/ie11-ie10-send-input-events-at-times-when-it-is-not-appropriate if you want to add to it |
This issue was fixed by #9265 EDIT: I originally posted a different comment here, one meant for another issue. Sorry if anyone got a confusing email. |
EDIT: I originally replied to @cvn here :P |
@bterlson I really, really want the |
Indeed, it is fixed in master: http://jsfiddle.net/du6zuuow/ - tested with IE9. |
When using the tab key to move through form fields, in Internet Explorer it sets the fields dirty.
The following jsFiddle demonstrates:
http://jsfiddle.net/symblify/XL6RX/1/
Click on the input box and press tab, and the text underneath changes from "false" to "true". It works okay in other browsers.
I think the keyCode for tab needs added to this line:
https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js#L394
The text was updated successfully, but these errors were encountered: