Skip to content

Commit 62977d0

Browse files
authored
fix(ui5-flexible-column-layout): correct columns display (#3444)
Sometimes timeout that adds ui5-fcl-column--hidden is executed when the calculations are already done. Executing the timeout callback later causes visual issue where column is hidden when it should be displayed. Now, timeout is replace with listener for transionend so if it is no longer needed to be removed. Fixes: #3425
1 parent 9832843 commit 62977d0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/fiori/src/FlexibleColumnLayout.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ class FlexibleColumnLayout extends UI5Element {
311311

312312
onExitDOM() {
313313
ResizeHandler.deregister(this, this._handleResize);
314+
315+
["start", "mid", "end"].forEach(column => {
316+
this[`${column}ColumnDOM`].removeEventListener("transitionend", this.columnResizeHandler);
317+
});
314318
}
315319

316320
onAfterRendering() {
@@ -407,20 +411,23 @@ class FlexibleColumnLayout extends UI5Element {
407411
columnDOM.style.width = columnWidth;
408412

409413
// hide column with delay to allow the animation runs entirely
410-
setTimeout(() => {
411-
columnDOM.classList.add("ui5-fcl-column--hidden");
412-
}, FlexibleColumnLayout.ANIMATION_DURATION);
414+
columnDOM.addEventListener("transitionend", this.columnResizeHandler);
413415

414416
return;
415417
}
416418

417419
// show column: from 0 to 33%, from 0 to 25%, etc.
418420
if (previouslyHidden) {
421+
columnDOM.removeEventListener("transitionend", this.columnResizeHandler);
419422
columnDOM.classList.remove("ui5-fcl-column--hidden");
420423
columnDOM.style.width = columnWidth;
421424
}
422425
}
423426

427+
columnResizeHandler(event) {
428+
event.target.classList.add("ui5-fcl-column--hidden");
429+
}
430+
424431
nextLayout(layout, arrowsInfo = {}) {
425432
if (arrowsInfo.start) {
426433
return getNextLayoutByStartArrow()[layout];

0 commit comments

Comments
 (0)