Skip to content

Commit 68b18d3

Browse files
fix(ui5-bar): prevent midContent from overlapping start and endContent on overflow (#11294)
Previously when the content inside the <ui5-bar> component, especially a long text in the midContent slot, was provided the content was overlapping the startContent and endContent, especially when the bar was resized or contained limited space. 2025-04-09_15-41-31 The reason behind this was that while all three content containers were using flex, they allowed the middle content (midContent) to grow too much. Now the startContent and endContent set to flex: 0 0 auto to maintain their natural size and prevent shrinking past their content. midContent set to flex: 1 1 auto to take up remaining space and shrink if needed. min-width: 0 on midContent to allow truncation. Added overflow: hidden to .ui5-bar-root so any overflowing content would be clipped rather than spill outside the bar (just like in UI5); 2025-04-09_15-45-32 Fixes: #11028 Co-authored-by: tsanislavgatev <[email protected]>
1 parent 72354bb commit 68b18d3

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

packages/main/src/themes/Bar.css

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,32 @@
1515
background-color: inherit;
1616
box-shadow: inherit;
1717
border-radius: inherit;
18+
min-width: 0;
19+
overflow: hidden;
1820
}
1921

20-
.ui5-bar-root .ui5-bar-startcontent-container {
21-
padding-inline-start: var(--_ui5_bar-start-container-padding-start);
22+
.ui5-bar-root .ui5-bar-startcontent-container,
23+
.ui5-bar-root .ui5-bar-endcontent-container,
24+
.ui5-bar-root .ui5-bar-midcontent-container {
2225
display: flex;
23-
flex-direction: row;
2426
align-items: center;
25-
justify-content: flex-start;
27+
}
28+
29+
.ui5-bar-root .ui5-bar-startcontent-container,
30+
.ui5-bar-root .ui5-bar-endcontent-container {
31+
flex: 0 0 auto;
32+
}
33+
34+
.ui5-bar-root .ui5-bar-midcontent-container {
35+
justify-content: center;
36+
flex: 1 1 auto;
37+
padding: 0 var(--_ui5_bar-mid-container-padding-start-end);
38+
min-width: 0;
39+
overflow: hidden;
40+
}
41+
42+
.ui5-bar-root .ui5-bar-startcontent-container {
43+
padding-inline-start: var(--_ui5_bar-start-container-padding-start);
2644
}
2745

2846
.ui5-bar-root .ui5-bar-content-container {
@@ -39,17 +57,6 @@
3957

4058
.ui5-bar-root .ui5-bar-endcontent-container {
4159
padding-inline-end: var(--_ui5_bar-end-container-padding-end);
42-
display: flex;
43-
flex-direction: row;
44-
align-items: center;
45-
justify-content: flex-end;
46-
}
47-
.ui5-bar-root .ui5-bar-midcontent-container {
48-
padding: 0 var(--_ui5_bar-mid-container-padding-start-end);
49-
display: flex;
50-
flex-direction: row;
51-
align-items: center;
52-
justify-content: center;
5360
}
5461

5562
:host([design="Footer"]){

0 commit comments

Comments
 (0)