SteveSanderson/knockout — Issue #215: bug in Chrome with select with options and value
Author: mbest
Created: 2011-11-30 09:50:29+00:00
State: open

I posted this in the forums also: http://groups.google.com/group/knockoutjs/browse_thread/thread/8c80a7a11a14b66a

I have put together a fiddle to demonstrate a bug in 1.3 RC that occurs in Chrome (version 15) with a select element with size > 1 and both an options and value binding. Here's the fiddle: http://jsfiddle.net/hKp59/

To see the bug, scroll down in the select box and select the item at the bottom of the box. The view of the select box moves back to the top although the scroll bar stays where it was.

Here's the same code/html linked to 1.3 beta to see it working properly: http://jsfiddle.net/r7gtD/

I figured out a fix for this:

In ko.bindingHandlers['options'].update, right after
var previousScrollTop = element.scrollTop;
add
element.scrollTop = 0;