diff --git a/sandbox/will/scrollbug.css b/sandbox/will/scrollbug.css new file mode 100644 index 000000000..d60bcad1b --- /dev/null +++ b/sandbox/will/scrollbug.css @@ -0,0 +1,9 @@ +Screen { + align: center middle; +} + +#test { + border: solid white; + background: blue; +} + diff --git a/sandbox/will/scrollbug.py b/sandbox/will/scrollbug.py new file mode 100644 index 000000000..6b4feae0f --- /dev/null +++ b/sandbox/will/scrollbug.py @@ -0,0 +1,19 @@ +from textual.app import App, ComposeResult +from textual.containers import Container +from textual.widgets import Header, Footer + + +class ScrollApp(App): + + BINDINGS = [("q", "quit", "QUIT")] + CSS_PATH = "scrollbug.css" + + def compose(self) -> ComposeResult: + yield Header() + yield Container(id="test") + yield Footer() + + +app = ScrollApp() +if __name__ == "__main__": + app.run() diff --git a/src/textual/_arrange.py b/src/textual/_arrange.py index 08010d397..2d89fad11 100644 --- a/src/textual/_arrange.py +++ b/src/textual/_arrange.py @@ -114,7 +114,9 @@ def arrange( for placement in layout_placements ] ).size - placement_offset += styles._align_size(placement_size, size).clamped + placement_offset += styles._align_size( + placement_size, region.size + ).clamped if placement_offset: layout_placements = [