@@ -102,6 +102,12 @@ func (l *List) getItem(idx int) renderedItem {
102 return ri
102 return ri
105+// invalidateItem invalidates the cached rendered content of the item at the
107+func (l *List) invalidateItem(idx int) {
108+ delete(l.renderedItems, idx)
105// ScrollToIndex scrolls the list to the given item index.
111// ScrollToIndex scrolls the list to the given item index.
106func (l *List) ScrollToIndex(index int) {
112func (l *List) ScrollToIndex(index int) {
107 if index < 0 {
113 if index < 0 {
@@ -314,11 +320,26 @@ func (l *List) Focus() {
314 if l.selectedIdx < 0 || l.selectedIdx > len(l.items)-1 {
320 if l.selectedIdx < 0 || l.selectedIdx > len(l.items)-1 {
324+ item := l.items[l.selectedIdx]
325+ if focusable, ok := item.(Focusable); ok {
327+ l.invalidateItem(l.selectedIdx)
319// Blur removes the focus state from the list.
331// Blur removes the focus state from the list.
320func (l *List) Blur() {
332func (l *List) Blur() {
321 l.focused = false
333 l.focused = false
334+ if l.selectedIdx < 0 || l.selectedIdx > len(l.items)-1 {
338+ item := l.items[l.selectedIdx]
339+ if focusable, ok := item.(Focusable); ok {
341+ l.invalidateItem(l.selectedIdx)
324// ScrollToTop scrolls the list to the top.
345// ScrollToTop scrolls the list to the top.