@@ -746,17 +746,21 @@ func (l *list[T]) GetSize() (int, int) {
746746
747747// GoToBottom implements List.
748748func (l *list[T]) GoToBottom() tea.Cmd {
749+ if l.offset != 0 {
750+ l.selectedItem = ""
751+ }
749752 l.offset = 0
750753 l.direction = DirectionBackward
751− l.selectedItem = ""
752754 return l.render()
753755}
754756
755757// GoToTop implements List.
756758func (l *list[T]) GoToTop() tea.Cmd {
759+ if l.offset != 0 {
760+ l.selectedItem = ""
761+ }
757762 l.offset = 0
758763 l.direction = DirectionForward
759− l.selectedItem = ""
760764 return l.render()
761765}
762766
@@ -997,6 +1001,7 @@ func (l *list[T]) UpdateItem(id string, item T) tea.Cmd {
9971001 if cmd != nil {
9981002 cmds = append(cmds, cmd)
9991003 }
1004+
10001005 // if the item is at least partially below the viewport
10011006 } else if oldPosition < oldItem.end {
10021007 newItem, ok := l.renderedItems.Get(item.ID())