Skip to content

Commit 8aa6c67

Browse files
authored
fix(flyout): content height wrong without header
Whenever a flyout contains actions but no header, the content height is miscalculated and the action container is misaligned. The resize calculation is also fixed now, as it was always expecting all 3 nodes (header,content,actions). Now it also works, if some or even none of them is available inside the flyout
1 parent a417fa7 commit 8aa6c67

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/definitions/modules/flyout.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,12 @@
557557
var
558558
$header = $module.children(selector.header),
559559
$content = $module.children(selector.content),
560-
$actions = $module.children(selector.actions)
560+
$actions = $module.children(selector.actions),
561+
newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0)
561562
;
562-
$content.css('min-height', ($context.height() - $header.outerHeight() - $actions.outerHeight()) + 'px');
563+
if (newContentHeight > 0) {
564+
$content.css('min-height', String(newContentHeight) + 'px');
565+
}
563566
},
564567
},
565568

src/definitions/modules/flyout.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,19 @@
101101
}
102102
.ui.flyout.left > .content,
103103
.ui.flyout.right > .content {
104+
min-height: @contentMinHeightWithoutHeader;
105+
}
106+
.ui.flyout.left > .header + .content,
107+
.ui.flyout.right > .header + .content {
104108
min-height: @contentMinHeight;
105109
}
106110
& when(@variationFlyoutScrolling) {
107111
.ui.flyout.left > .scrolling.content,
108112
.ui.flyout.right > .scrolling.content {
113+
max-height: @scrollingContentMaxHeightWithoutHeader;
114+
}
115+
.ui.flyout.left > .header + .scrolling.content,
116+
.ui.flyout.right > .header + .scrolling.content {
109117
max-height: @scrollingContentMaxHeight;
110118
}
111119

src/themes/default/modules/flyout.variables

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545

4646
/* Scrolling Content */
4747
@contentMinHeight: calc(100vh - 9.1rem);
48+
@contentMinHeightWithoutHeader: calc(100vh - 4.7rem);
4849
@scrollingContentMaxHeight: @contentMinHeight;
50+
@scrollingContentMaxHeightWithoutHeader: @contentMinHeightWithoutHeader;
4951
@scrollingContentMaxHeightTopBottom: calc(80vh - 9.1rem);
5052

5153
/* Close Icon */

0 commit comments

Comments
 (0)