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
Textual supports visible children of an invisible container -- this can be helpful with some approaches to laying things out. However, it seems that the visible children of the invisible container aren't seen as part of the focus chain; they can't be tabbed to with the keyboard.
Example code:
fromtextual.appimportApp, ComposeResultfromtextual.containersimportHorizontal, Verticalfromtextual.widgetsimportButton, LabelclassInvisibleContainerFocusApp(App[None]):
CSS=""" #invisible { visibility: hidden; } #invisible > * { visibility: visible; } """defcompose(self) ->ComposeResult:
withHorizontal():
withVertical():
yieldLabel("The container for this is visible")
for_inrange(10):
yieldButton()
withVertical(id="invisible"):
yieldLabel("The container for this is invisible")
for_inrange(10):
yieldButton()
if__name__=="__main__":
InvisibleContainerFocusApp().run()
The text was updated successfully, but these errors were encountered:
…focus chain (#3070)
* Add regression tests for #3053
* Traverse invisible containers when computing focus chain.
At the moment, we were completely bypassing invisible containers which meant that their visible children wouldn't be included in the focus chain.
* Make note of removed property.
* Add regression test for #3071.
* Fix#3071.
* Fix regression test for #3053.
* Optimize computation of focus chain.
Computing the focus chain was relying on the property 'visible' of nodes which may traverse the DOM up to find the visibility of a given node. Instead, we cache the visibility of the nodes we traverse and keep them in a stack, saving some of that computation.
Related issues: #3071
Related comments: #3070 (comment)
* Make test more robust.
* Make test more robust.
* Short-circuit disabled portions of DOM.
If a node is disabled, we will not be focusable, nor will its children, so we can skip it altogether.
Related review comment: https://github.com/Textualize/textual/pull/3070/files#r1300292492
* Simplify traversal.
The traversal code could be simplified after reordering some lines of code.
We also get rid of the visibility stack and instead keep everything in the same stack.
Related comments: #3070 (review)
Textual supports visible children of an invisible container -- this can be helpful with some approaches to laying things out. However, it seems that the visible children of the invisible container aren't seen as part of the focus chain; they can't be tabbed to with the keyboard.
Example code:
The text was updated successfully, but these errors were encountered: