Skip to content

Commit a8a4acd

Browse files
feat(ui5-bar): implement resize handlers for each slot (#5482)
fixes: #4901
1 parent b90bf68 commit a8a4acd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/fiori/src/Bar.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ class Bar extends UI5Element {
181181
onBeforeRendering() {
182182
// Next row is specific for IE11. Please remove after stop support and edit css file
183183
[...this.startContent, ...this.middleContent, ...this.endContent].forEach(element => element.classList.add("ui5-bar-content"));
184+
185+
this.startContent.forEach(slotItem => { ResizeHandler.deregister(slotItem, this._handleResizeBound); }, this);
186+
this.middleContent.forEach(slotItem => { ResizeHandler.deregister(slotItem, this._handleResizeBound); }, this);
187+
this.endContent.forEach(slotItem => { ResizeHandler.deregister(slotItem, this._handleResizeBound); }, this);
188+
}
189+
190+
onAfterRendering() {
191+
this.startContent.forEach(slotItem => { ResizeHandler.register(slotItem, this._handleResizeBound); }, this);
192+
this.middleContent.forEach(slotItem => { ResizeHandler.register(slotItem, this._handleResizeBound); }, this);
193+
this.endContent.forEach(slotItem => { ResizeHandler.register(slotItem, this._handleResizeBound); }, this);
184194
}
185195

186196
onEnterDOM() {

packages/fiori/test/pages/Bar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<section>
2121
<ui5-title level="3">Header design</ui5-title>
2222
<ui5-bar design="Header">
23-
<ui5-button icon="home" tooltip="Go home" slot="startContent"></ui5-button>
23+
<ui5-title id="titleElement" slot="startContent">Title</ui5-title>
2424
<ui5-label>Title</ui5-label>
2525
<ui5-button icon="action-settings" tooltip="Go to settings" slot="endContent"></ui5-button>
2626
</ui5-bar>

0 commit comments

Comments
 (0)