-
-
Couldn't load subscription status.
- Fork 1k
Closed
Description
There seems to be a problem with scrollable containers. Consider an example:
from __future__ import annotations
from textual.app import App, ComposeResult
from textual.widgets import Label
from textual.containers import ScrollableContainer, Grid
class MyApp(App):
DEFAULT_CSS = """
Grid {
grid-size: 2;
grid-rows: auto;
height: auto;
}
Label {
height: 1;
background: red;
}
"""
def compose(self) -> ComposeResult:
with ScrollableContainer(), Grid():
yield Label("First")
yield Label("Second")
yield Label("Third")
yield Label("Fourth")
yield Label("Fifth")
yield Label("Sixth")
MyApp().run()
In this case I would expect the scroll to appear when the Fifth and Sixth labels are hidden, but:

There is no reaction.
After adding some padding, scroll appears when all the labels are hidden, and when I scroll down I don't see any of them.
I have noticed a similar problem with TabbedContent:
from __future__ import annotations
from textual.app import App, ComposeResult
from textual.widgets import Label, TabPane, TabbedContent
from textual.containers import ScrollableContainer, Grid
class MyTabPane(TabPane):
DEFAULT_CSS = """
Grid {
grid-size: 2;
grid-rows: auto;
padding: 2 4;
height: auto;
}
Label {
height: 1;
background: red;
}
"""
def compose(self) -> ComposeResult:
with ScrollableContainer(), Grid():
yield Label("First")
yield Label("Second")
yield Label("Third")
yield Label("Fourth")
yield Label("Fifth")
yield Label("Sixth")
class MyApp(App):
def compose(self) -> ComposeResult:
with TabbedContent():
yield MyTabPane("example")
MyApp().run()
This is when the scroll appears and again I can't see any element that is under the ScrollableContainer.

Metadata
Metadata
Assignees
Labels
No labels