diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index 5c1b4baa3f..d19cd75b6b 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -1037,10 +1037,13 @@ BListView::ScrollToSelection() if (Bounds().Contains(itemFrame)) return; - if (itemFrame.top < Bounds().top) - ScrollTo(itemFrame.left, itemFrame.top); - else - ScrollTo(itemFrame.left, itemFrame.bottom - Bounds().Height()); + float scrollPos = itemFrame.top < Bounds().top ? + itemFrame.top : itemFrame.bottom - Bounds().Height(); + + if (itemFrame.top - scrollPos < Bounds().top) + scrollPos = itemFrame.top; + + ScrollTo(itemFrame.left, scrollPos); }