sunesimonsen/knockout.list — pull request #6 by mwoc (2013-10-14 15:46:09+00:00)
Title: When showIndex has to show index 0 and the item at that index isn't visible, no scrollTop done

Version 0.0.11:

```
// Make sure to show as many dividers above the first item as possible
// by trying to align the item with the bottom instead
var isFirstItem = index === 0;
if (!isFirstItem && tileTop <= $element.scrollTop()) {
$element.scrollTop(tileTop);
} else if ($element.scrollTop() + $element.height() <= tileBottom) {
$element.scrollTop(tileBottom - $element.height());
}
```

Values of relevant variables:

Number of items: 47 (below eviction threshold)
isFirstItem: true
tileTop: 0
tileBottom: 48
$element.scrollTop(): 530
$element.height(): 964

As isFirstItem is true, the check for finding out if we need to scroll upwards is not run, only the check for scrolling downwards which by definition never is necessary for the first item in the list.

I presume you meant to do $element.scrollTop(0) if isFirstItem is true? Or what is the thought behind it exactly?

Anyways, here's a pull request assuming my presumption to be right.