Skip to content

Commit 260069d

Browse files
committed
Merge branch 'main' into fix-scrollbar-fix-scrollbar-background-opacity
2 parents 152b6c2 + f5be1b7 commit 260069d

File tree

5 files changed

+202
-2
lines changed

5 files changed

+202
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4343
- Fixed `Pilot.click` not working with `times` parameter https://github.com/Textualize/textual/pull/5398
4444
- Fixed select refocusing itself too late https://github.com/Textualize/textual/pull/5420
4545
- Fixed Log widget not refreshing on resize https://github.com/Textualize/textual/pull/5460
46+
- Fixed special case with calculating the height of a container where all children have dynamic heights https://github.com/Textualize/textual/pull/5463
4647
- Fixed scrollbars ignoring background opacity https://github.com/Textualize/textual/issues/5458
4748

4849

src/textual/layout.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,15 @@ def get_content_height(
257257
Content height (in lines).
258258
"""
259259
if widget._nodes:
260-
arrangement = widget._arrange(Size(width, 0))
260+
if not widget.styles.is_docked and all(
261+
child.styles.is_dynamic_height for child in widget.displayed_children
262+
):
263+
# An exception for containers with all dynamic height widgets
264+
arrangement = widget._arrange(
265+
Size(width, container.height - widget.gutter.height)
266+
)
267+
else:
268+
arrangement = widget._arrange(Size(width, 0))
261269
height = arrangement.total_region.bottom
262270
else:
263271
height = 0

src/textual/layouts/grid.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ def arrange(
2828
parent.pre_layout(self)
2929
styles = parent.styles
3030
row_scalars = styles.grid_rows or (
31-
[Scalar.parse("1fr")] if size.height else [Scalar.parse("auto")]
31+
[Scalar.parse("1fr")]
32+
if (size.height and not parent.styles.is_auto_height)
33+
else [Scalar.parse("auto")]
3234
)
3335
column_scalars = styles.grid_columns or [Scalar.parse("1fr")]
3436
gutter_horizontal = styles.grid_gutter_horizontal

0 commit comments

Comments
 (0)