diff --git a/widget/list.go b/widget/list.go index 90b7fa090f..1927fa854d 100644 --- a/widget/list.go +++ b/widget/list.go @@ -130,6 +130,7 @@ func (l *List) RefreshItem(id ListItemID) { return } l.BaseWidget.Refresh() + l.Unselect(id) lo := l.scroller.Content.(*fyne.Container).Layout.(*listLayout) lo.renderLock.RLock() // ensures we are not changing visible info in render code during the search item, ok := lo.searchVisible(lo.visible, id) @@ -386,6 +387,17 @@ func (l *List) contentMinSize() fyne.Size { return fyne.NewSize(l.itemMin.Width, height+separatorThickness*float32(items-1)) } +func (l *List) Tapped(event *fyne.PointEvent) { + canvas := fyne.CurrentApp().Driver().CanvasForObject(l) + if canvas != nil { + // First, unfocus the currently focused widget if any + if l.focused { + l.FocusLost() + } + canvas.Focus(l) + } +} + // fills l.visibleRowHeights and also returns offY and minRow func (l *listLayout) calculateVisibleRowHeights(itemHeight float32, length int, th fyne.Theme) (offY float32, minRow int) { rowOffset := float32(0)