-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix clicking on empty part of widget.List not unfocusing #5314
base: develop
Are you sure you want to change the base?
Changes from all commits
bb78c11
9a34d2f
1e33f9b
8f27762
3b9c451
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the PR says it is unfocusing but this code shows focussing - is this correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
when the empty portion is clicked the widgets (Entry, list items) are getting unfocused --> the issue This PR resolves this issue --> The widgets get unfocused when we click the empty portion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we should do this by unfocusing surely? |
||
} | ||
} | ||
|
||
// 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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an unrelated change? Why are the semantics of RefreshItem changing to that you can't use it to refresh a selected item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this code is not allowing an item to remain selected when it is refreshed - so scrolling will lose the selected status