You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a Discord discussion, @danbulant was asking about how to handle directing the enter key to submitting a form more easily than overriding on_key on everything. I pointed to Default widgets but the limitation is that they are one-per-window.
This spawned a thought for me: what if we can support multiple default widgets. Perhaps each time focus is shifted, an "active default" widget is chosen by determining which default widget available has the shortest "tree distance" between itself and the currently focused widget. This widget can then show the default styling, and as the keyboard focus shifts around the window the default widget will shift based on the tree distance.
What is the tree distance? I think it is the sum of the distance between each widget and the closest common ancestor. This should mean that form widgets that are contained within the same layout container will be preferred since the distance between the button and each widget and the layout container will be smaller than the distance to any other widget outside of that layout container.
The text was updated successfully, but these errors were encountered:
Another idea would be to have a Form widget which would explicitly wrap the elements for submitting data, and have default button/widget send that event up (though that would require documentation that a form widget must exist as a parent somewhere - maybe window could panic if it received this event? Or window could accept those events and process them too?)
From a Discord discussion, @danbulant was asking about how to handle directing the enter key to submitting a form more easily than overriding on_key on everything. I pointed to Default widgets but the limitation is that they are one-per-window.
This spawned a thought for me: what if we can support multiple default widgets. Perhaps each time focus is shifted, an "active default" widget is chosen by determining which default widget available has the shortest "tree distance" between itself and the currently focused widget. This widget can then show the default styling, and as the keyboard focus shifts around the window the default widget will shift based on the tree distance.
What is the tree distance? I think it is the sum of the distance between each widget and the closest common ancestor. This should mean that form widgets that are contained within the same layout container will be preferred since the distance between the button and each widget and the layout container will be smaller than the distance to any other widget outside of that layout container.
The text was updated successfully, but these errors were encountered: