Chrome Update 57 or 58

62 views
Skip to first unread message

Chad Bozeman

unread,
Nov 30, 2017, 3:57:46 PM11/30/17
to KnockoutJS
I have a number field data bound to a computed function. As that field value changes, the calculation updates and the output works like a champ. However in Chrome 57 or 58 the up/down arrows on number fields suddenly stopped working. It still works but the computed observables don't update until I move the mouse.off of the up/down arrow.

Anyone else experiencing this? I can't seem to find a workaround.

Michael Best

unread,
Nov 30, 2017, 6:38:08 PM11/30/17
to KnockoutJS
sample code?

Chad Bozeman

unread,
Dec 1, 2017, 9:21:46 AM12/1/17
to KnockoutJS
Let me apologize in advance for this Fiddle. This is built in MVC and the mappings are so numerous that I've tried to water it down to a workable example. I have no idea how to make Fiddle work with the way we execute our scripts so I'm having trouble getting a Fiddle to even work correctly. But this will at least show you the code even though I've missed something somewhere in setting up the Fiddle. We're using KO 3.4.2 and jQuery 3.2.1.

Chad Bozeman

unread,
Dec 1, 2017, 9:35:11 AM12/1/17
to KnockoutJS
Actually I just took KO's Hello World example and modified it to do the same thing. They're not using a computed function, but the result is the same. Using the arrow keys on Chrome does not update the bindings until the mouse moves off of the arrow.

Andrew Vickers

unread,
Dec 1, 2017, 3:36:01 PM12/1/17
to KnockoutJS
Chrome is weird about the events it triggers in this case.  Using the 'event' binding will resolve this, but make the html ugly.

<p>Last name: <input type='number' data-bind='value: lastName, event: { input: doInput }' /></p>

ViewModel =
...
this.lastName = ko.observable(last);
    
this.doInput = function(o,e) {
      this.lastName(e.srcElement.value);
    }


Cheers

Michael Best

unread,
Dec 1, 2017, 4:58:39 PM12/1/17
to KnockoutJS
The proper way to handle the input event is valueUpdate:

value: lastName, valueUpdate: "input"

You can also use the textInput binding.

But this seems like a bug in Chrome.
Reply all
Reply to author
Forward
0 new messages