-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internet Explorer and AutoComplete #122
Conversation
Thanks for reporting this. Sounds like it should be reasonably straightforwards to fix. I'll schedule it for 1.3.1, unless you want to submit a pull request. |
+1 on this, it is very annoying! |
If you add "onpropertychange" and "DOMAttrModified" events to the list of events watched by the value binding(src/binding/defaultBindings.js#119), it works in IE, FF and Opera. |
Hi Steve, I just wanted to check if this fix is applied in 2.0 - the login process on my site relies on Knockout, so it's a pretty serious bug for me! I'm using a custom version of 1.2 at the moment, so I applied @thelinuxlich 's suggestion and it worked a treat. |
We'll have a fix in 2.1.0 if at all possible (that's the same as 1.3.1 in the new numbering scheme). About |
My workaround to this problem was to simply disable auto complete in the browser and avoid this situation altogether: I didn't attempt to implement a fix for it. |
As far as I can remember I couldn't reproduce the bug in IE9, only IE8 (I didn't test earlier versions). Adding "onpropertychange" fixed the problem for me. |
See also the |
Optimize write calls from binding handlers to use a common function. (Makes this change size neutral.)
…ng-term understanding of this. Core mechanism not affected.
This looks great - thanks very much. And good work on identifying the repeated I made slight tweaks only to the code style to help myself be sure I understand what it does (e.g., didn't think that It's a pity we can't have an automated test to verify this works (as it relies on the user clicking on the browser's native autocomplete UI), and I'm not in a position to test it robustly right now. If you're confident that this works, I'll trust you :) -please go ahead and merge it in if so. |
I made I noticed you changed where I replaced |
Will this cause KO observables to change on every keystroke now in IE? If so, this would cause issues if you had AJAX calls that depended on an observable (computed) where you'd expect it to fire once when the user is done changing an observable. |
The change to the observable will happen on the |
Ah, I see, very subtle! Thinking about this further, in your original commit 3e63a39, wouldn't overwriting So, what's the best way to avoid breaking this? One possibility would be we don't overwrite What do you think? Am I missing any other subtle cases? |
Steve, You are right that my version would cause a different breaking change. I hadn't thought of that. I suggest we keep it like it is now. Although there will be an additional update in IE, I think that's better than possibly losing updates. |
…previously, IE would update the observable twice)
OK then, this all seems to make sense now. How about we just use your For the majority of cases, it won't actually make any difference, because observables automatically suppress repeated writes of the same value anyway. Developers will only be able to see a difference if they are using the If you don't see any problems with this approach, please either merge this in, or let me know and I'll do the merge. Thanks! |
Internet Explorer and AutoComplete
Am I missing something? This bug is still showing up for me in IE10 while running in IE9 comptability (or lower): http://jsfiddle.net/KLCqg/2/ |
To be clear, the issue I am having is with saved password, not autocomplete on a single box. When you enter a saved username, the password that it put into the password box doesn't get sent to the observable. Even when I tab out of the password box, it remains empty. I have to completely remove the password and enter new one before it gets updated. |
Ok, so more details. First, new fiddle: http://jsfiddle.net/KLCqg/3/ I was using 'onblur', not 'blur' for the valueUpdate. This should be in the documentation. Second, the fix requires blur to happen on the field that is updated, but in the case of a login form (pretty standard), the username being filled in causes the password to be updated. If users don't move to the password field, but immediately click on the sign in button, password never gets a blur, and the bound observable doesn't get updated. You can see this happen in the fiddle. I can hack together something that raises blur on the password field, but this is still an issue in the general case. |
@tyrsius, I seems the problem you are having is unrelated to what we tried to fix with this issue. I looked into something recently based on a comment on StackOverflow and confirmed that IE10 in compatibility mode has a bug with the |
Well, I get the same error when running in IE10 without compatibility. I haven't been able to test in a real IE8 or 9, but in IE10 running under any browser mode I get this same behavior: the observable isn't updated. I may be confused, but that StackOverflow question seems to be discussing a double update. I am not getting any updates. I would be fine with two. If this is unrelated, then there is a new issue that exhibits the same behavior. Do you want me to open a new issue? |
@tyrsius While it may seem you can fix this issue with all sort of events available, I can only say it's painless and useless...For example, you might also have issues with extensions such as Lastpass or Keypass - or even with FireFox's autofill. I ended up getting the values upon clicking the Login button, and put them manually in the observables. It kind of defeats the KO purpose...but I no longer have to fix stupid bugs. I found the below script useful for other cases, ie. drag-drop, other IE issues. function fixInputChangeEvent() {
var sendChangeNotification = function() {
if (document.activeElement !== this) {
// Send change notification only if the active element is different
jQuery(this).trigger('change');
}
};
jQuery(document.body).on('input', 'input[type="text"],input[type="password"]', function() {
// Send the change notification
window.setTimeout(jQuery.proxy(sendChangeNotification, this), 0);
});
} |
@crissdev I think that would result in a lot more activity than should be necessary to fix the issue. You are setting up a handler for the entire body. |
Sounds good. |
@crissdev That solution does not appear to work for this case. |
This may be related to case #102.
When using Internet Explorer (version 9.0.8112.16421 in my case) i have a problem with observables not being updated on input change when using the browser's autocomplete.
Here is a recipe for reproducing it.
See also this page:
http://msdn.microsoft.com/en-us/library/ms533032(v=vs.85).aspx
The project I'm working on is also using jquery.validate.js. In this framework the validation is triggered correctly also on AutoComplete - so maybe it could be an idea to study how they've implemented it there.