binding icon indicating copy to clipboard operation
binding copied to clipboard

Password value binding triggers updateTarget?

Open jods4 opened this issue 9 years ago • 11 comments

I am observing a strange beahvior that is causing me trouble.

I have a simple value binding + behavior on a password field: <input type=password value.bind="p & validate" />.

When I type text in the input, I see updateSource is called, as expect. When I mash keys -- or simply press two keys at the same time -- it seems updateTarget is called as well. But why? This is causing unwanted side-effects in my binding behavior.

This is easy to reproduce in IE11 with a password box: just hit two keys at the same time. It seems it sometimes happens with a normal textbox as well, but it is a lot harder to reproduce.

jods4 avatar Jul 21 '16 17:07 jods4

does it happen in other browsers too? Whats the call stack? Can you provide a plunker?

jdanyow avatar Jul 21 '16 21:07 jdanyow

It does easily happen in Edge as well. Does not seem to happen on Firefox. Untested in Chrome.

Here's a plunker: https://plnkr.co/9cF0XO8FjPK6relatTf5

There's one updateTarget at startup, which is probably because I did not define x on the model, so it gets updated from undefined to "" (I guess).

But then if you hit two keys at the same time, you very easily get a updateTarget on IE11 and Edge.

As for the callstack, I would like to take the opportunity to say that the TaskQueue makes it often quite hard to track causality. All the bindings are updated in this micro-queue... I wonder if there is a way to opt-in long stack traces like built-in async callbacks do in the Edge debugger callstack.

jods4 avatar Jul 21 '16 22:07 jods4

I see it happening in edge too. not in chrome, firefox or IE11.

https://plnkr.co/edit/ahRwzTeRjFeCYKUs0U1c?p=preview

jdanyow avatar Jul 23 '16 01:07 jdanyow

@jdanyow Good that you can reproduce it! I experienced it first on IE11, not sure why you don't.

Any idea where it comes from?

jods4 avatar Jul 23 '16 13:07 jods4

No, not yet. I also looked at adding a "long stack traces" plugin for the TaskQueue to help with the debugging thing you mentioned.

jdanyow avatar Jul 23 '16 20:07 jdanyow

Did you ever find a fix for this? I'm experiencing the same problem; I've narrowed it down to Binding.prototype.call in Aurelia-binding.js. what I'm seeing is that in Chrome when pressing two keys at once in a textarea input that when getting the value from the textarea it only includes the first key typed, but in IE11 it shows both keys - hence it executes the code if (newValue !== oldValue). I hope that makes sense. I came across this from users telling me the cursor always jumped to the end of their text if they moved back into the text and typed quickly.

huw489 avatar Dec 08 '16 17:12 huw489

@jdanyow Putting this back on your radar.

EisenbergEffect avatar Dec 13 '16 05:12 EisenbergEffect

Stale since 2016

Alexander-Taran avatar Mar 12 '18 01:03 Alexander-Taran

@jdanyow Can you comment?

EisenbergEffect avatar Mar 12 '18 02:03 EisenbergEffect

or @jods4 ? (-:

Alexander-Taran avatar Jan 07 '19 17:01 Alexander-Taran

@Alexander-Taran Unfortunately the plunker is gone but I think the description of the problem is clear?

jods4 avatar Jan 08 '19 09:01 jods4