File tree Expand file tree Collapse file tree 3 files changed +43
-14
lines changed Expand file tree Collapse file tree 3 files changed +43
-14
lines changed Original file line number Diff line number Diff line change @@ -259,18 +259,7 @@ def get_content_height(
259
259
if not widget ._nodes :
260
260
height = 0
261
261
else :
262
- # Use a height of zero to ignore relative heights
263
- styles_height = widget .styles .height
264
- if widget ._parent and len (widget ._nodes ) == 1 :
265
- # If it is an only child with height auto we want it to expand
266
- height = (
267
- container .height
268
- if styles_height is not None and styles_height .is_auto
269
- else 0
270
- )
271
- else :
272
- height = 0
273
- arrangement = widget ._arrange (Size (width , height ))
262
+ arrangement = widget ._arrange (Size (width , 0 ))
274
263
height = arrangement .total_region .bottom
275
264
276
265
return height
Original file line number Diff line number Diff line change 3
3
4
4
5
5
class HappyDataTableFunApp (App [None ]):
6
- """The DataTable should expand as if it has height 1fr ."""
6
+ """The DataTable should expand to full the screen and show a horizontal scrollbar ."""
7
7
8
8
CSS = """
9
+ #s {
10
+ max-height: 100%;
11
+ }
9
12
DataTable {
10
13
max-height: 100%;
11
14
}
Original file line number Diff line number Diff line change @@ -1385,7 +1385,7 @@ def test_vertical_max_height(snap_compare):
1385
1385
1386
1386
1387
1387
def test_max_height_100 (snap_compare ):
1388
- """Test vertical max height takes border in to account ."""
1388
+ """Test a datatable with max height 100% ."""
1389
1389
assert snap_compare (SNAPSHOT_APPS_DIR / "max_height_100.py" )
1390
1390
1391
1391
@@ -3074,3 +3074,40 @@ def compose(self):
3074
3074
yield MainContainer ()
3075
3075
3076
3076
snap_compare (Test1 ())
3077
+
3078
+
3079
+ def test_auto_parent_with_alignment (snap_compare ):
3080
+ class Sidebar (Vertical ):
3081
+ DEFAULT_CSS = """
3082
+ Sidebar {
3083
+ dock: right;
3084
+ width: auto;
3085
+ height: auto;
3086
+ background: blue;
3087
+ align-vertical: bottom;
3088
+
3089
+ #contents {
3090
+ width: auto;
3091
+ height: auto;
3092
+ background: red;
3093
+ border: white;
3094
+ }
3095
+ }
3096
+ """
3097
+
3098
+ def compose (self ) -> ComposeResult :
3099
+ with Vertical (id = "contents" ):
3100
+ yield Button ("Start" )
3101
+ yield Button ("Stop" )
3102
+
3103
+ class FloatSidebarApp (App ):
3104
+ CSS = """
3105
+ Screen {
3106
+ layers: base sidebar;
3107
+ }
3108
+ """
3109
+
3110
+ def compose (self ) -> ComposeResult :
3111
+ yield Sidebar ()
3112
+
3113
+ snap_compare (FloatSidebarApp ())
You can’t perform that action at this time.
0 commit comments