fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.89k stars 1.38k forks source link

Focus for collection widgets always lands on first item, even if scrolled #4131

Open dweymouth opened 1 year ago

dweymouth commented 1 year ago

Checklist

Describe the bug

With the new focus handling for collection widgets, the first time the widget is focused, the focus always lands on the first item, even if the collection has been scrolled such that the first item is not visible.

This seems like a bug, not intended behavior, and that the focus should land on the first visible item (side question - should it be the first fully visible item or first partially visible item?)

Another separate question is if the widget has focus, but is then scrolled so that the focused item is out of the viewport, if the next focus action should reset it back to the first visible item.

How to reproduce

run fyne-demo and scroll either the list, tree, table, or gridwrap before focusing it

Screenshots

No response

Example code

fyne_demo

Fyne version

develop

Go compiler version

1.19.2

Operating system and version

Mac OS

Additional Information

No response

andydotxyz commented 1 year ago

It was kindof intended yes, but not with any huge amount of research. It's a complex question because mouse scroll and focused widget have only a very loose relationship so I'm pretty sure they scrolling should not change established focus location. What to do if it was never set before is an interesting question - probably requires some research and the implementation will need to be more complex if we need to track whether something has ever been focused...