Skip to content

Commit e5c0f2d

Browse files
authored
fix(ui5-bar): fix rtl support (#4496)
1 parent 303ecb1 commit e5c0f2d

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

packages/fiori/src/Bar.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
aria-label="{{accInfo.label}}"
44
role="toolbar"
55
part="bar"
6+
dir={{effectiveDir}}
67
>
78
<div class="ui5-bar-content-container ui5-bar-startcontent-container">
89
<slot name="startContent"></slot>

packages/fiori/src/Bar.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const metadata = {
5454
*/
5555
startContent: {
5656
type: HTMLElement,
57+
propertyName: "startContent",
5758
},
5859

5960
/**
@@ -75,6 +76,7 @@ const metadata = {
7576
*/
7677
endContent: {
7778
type: HTMLElement,
79+
propertyName: "endContent",
7880
},
7981
},
8082
events: /** @lends sap.ui.webcomponents.fiori.Bar.prototype */ {
@@ -168,6 +170,12 @@ class Bar extends UI5Element {
168170
};
169171
}
170172

173+
onBeforeRendering() {
174+
// Next two row is specific for IE11. Please remove after stop support and edit css file
175+
const content = this.startContent.concat(this.middleContent).concat(this.endContent);
176+
content.forEach(e => e.classList.add("ui5-bar-content"));
177+
}
178+
171179
onEnterDOM() {
172180
ResizeHandler.register(this, this._handleResizeBound);
173181
}

packages/fiori/src/themes/Bar.css

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,23 @@
6666
box-shadow: var(--sapContent_Shadow1);
6767
border: none;
6868
}
69+
/* This selector works well for all browsers except IE11.
70+
After support for IE11 is stopped, the specific selectors added for it can be removed and this selector can be uncommented*/
71+
/* ::slotted(*) {
72+
margin: 0 0.25rem;
73+
} */
6974

70-
::slotted(*){
75+
/*Specific selector added for support in IE11*/
76+
::slotted(.ui5-bar-content) {
7177
margin: 0 0.25rem;
78+
}
79+
80+
[dir="rtl"] .ui5-bar-startcontent-container {
81+
padding-right: 0.5rem;
82+
padding-left: 0;
83+
}
84+
85+
[dir="rtl"] .ui5-bar-endcontent-container {
86+
padding-left: 0.5rem;
87+
padding-right: 0;
7288
}

0 commit comments

Comments
 (0)