-
Notifications
You must be signed in to change notification settings - Fork 570
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
Clarify the relation of focus and propagate_to_hidden
#1716
Comments
Your understanding is correct; a 'hidden' widget is a widget that is part of the widget tree but is not currently a functional part of the UI, generally because it is part of a switch/either/tab that is not visible. I also agree that a widget that is in a scroll view and is not onscreen is not "hidden". |
Ok, then i will create a PR with the changes. I would like to test in |
The first part sounds good. The second part is... maybe okay? I'm always a little scared of complicating the logic more than possible. Thinking this through, I'm not sure if it really matters if a hidden widget gets the 'resign' message, assuming it gets some message when it becomes hidden? (does this happen? 😬) |
I don't think so. Since hidden means the parent widget decided at some point not to show the widget anymore, the widget itself doesn't know that it's hidden. If a textbox inside a tab widget is focused and you select another tab, druid thinks the textbox is still focused until you click another one. |
I think we can close this now |
As i understand it, hidden in
propagate_to_hidden()
means the widget, is inside the widget tree, but can't be seen. Not because it is overlaid by another component, but because it doesn't have a position inside the current window (like a widget inside a hidden Tab). On the other hand, a component in a scroll would not be "hidden" according to my understanding, even if you can't see it right now.Therefore a component can participate in focus if and only if it is not hidden.
Which means for one thing that my implementation for the
Lifecycle::BuildFocusChain
in #1632 is wrong since it includes all hidden tabs.But also, to fix this we would probably need a context methodCalling children changed should be enough.children_state_changed()
which would request a rebuild of the focus_chain (for an example when selecting another Tab).Another thing we should think about is what happens to focused widgets which become hidden.
The text was updated successfully, but these errors were encountered: