Open matwachich opened 1 year ago
Some info, hoping it will help: The fyne.Focusable is always hidden when tab.OnSelected is called.
This means that the name OnSelected is somewhat not true. The function should be called after all widgets contained in the tab item are called.
The problem is that OnSelected is called before tab.Refresh().
So current simple working workaround is just to call tab.Refresh() in the begining of OnSelected.
I wonder if it is possible that selected and visible are being confused? The visual state of the UI may lag the data present, and selected is a data state that will later be shown in a refresh call?
There is no confusion for me. Of course one is a state and the other is a visual, but the latter prevents the first from doing something (thus, focusing some widget upon tab selection).
It is not really critical (since you just need to Refresh the tab container before focusing), and if solving this means breaking other things, or just breaking code logic, then it doesn't worth it.
What I mean is, the "unselected" is a data event - the user has made a selection - but what is visible changes based on a visual refresh so may indeed lag.
I think one possible fix is to track requests to focus for things not yet visible/added. This did previously work I think, but there was a change so that hidden or not-added container items could not be focused...
Almost reported the same issue, then found this one, including the workaround, thanks @matwachich. Tested on the develop branch pulled a few minutes ago, and it's still the case.
Checklist
Describe the bug
Calling .Focus(widget) inside AppTabs/DocTabs.OnSelected doesn't work.
Calling .Focus() inside a 500ms delayed goroutine works.
Something to do with tab changing animation?
How to reproduce
Just run the provided code. The Entry inside each tabitem should be focused on tab selection.
Screenshots
No response
Example code
Fyne version
2.3.0
Go compiler version
1.19.1
Operating system
Windows
Operating system version
10
Additional Information
No response