Skip to content

Commit d6c2cbc

Browse files
authored
fix(ui5-tabcontainer): Fix overflow visibility (#1993)
When the tabcontaioner is no longer scrollable, the overflow arrows hides, the overflow popover should be closed as well. Previously it was automatically, but now as the focus is within the popover, it remains open, if not handled.
1 parent dd4633e commit d6c2cbc

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/main/src/TabContainer.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,8 @@ class TabContainer extends UI5Element {
446446
this._updateScrolling();
447447
}
448448

449-
_closeRespPopover() {
449+
async _closeRespPopover() {
450+
this.responsivePopover = await this._respPopover();
450451
this.responsivePopover.close();
451452
}
452453

@@ -456,6 +457,10 @@ class TabContainer extends UI5Element {
456457
this._scrollable = headerScrollContainer.offsetWidth < headerScrollContainer.scrollWidth;
457458
this._scrollableBack = headerScrollContainer.scrollLeft > 0;
458459
this._scrollableForward = Math.ceil(headerScrollContainer.scrollLeft) < headerScrollContainer.scrollWidth - headerScrollContainer.offsetWidth;
460+
461+
if (!this._scrollable) {
462+
this._closeRespPopover();
463+
}
459464
}
460465

461466
_getHeader() {

packages/main/test/specs/TabContainer.spec.js

+18
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ describe("TabContainer general interaction", () => {
6767

6868
assert.ok(!arrowLeft.isDisplayed(), "'Left Arrow' should be hidden after 'Left arrow' click");
6969
assert.ok(arrowRight.isDisplayed(), "'Right Arrow' should be visible after 'Left arrow' click");
70+
71+
// act: open overflow
72+
const overflowBtn = browser.$("#tabContainerTextOnly").shadow$(".ui-tc__overflowButton");
73+
overflowBtn.click();
74+
75+
// assert: the overflow popover is open.
76+
const staticAreaItemClassName = browser.getStaticAreaItemClassName("#tabContainerTextOnly")
77+
const overflowPopover = browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
78+
assert.strictEqual(overflowPopover.isDisplayedInViewport(), true,
79+
"Popover is open.");
80+
81+
// act: resize, so the overflow button is not visible
82+
browser.setWindowSize(1400, 1080);
83+
browser.pause(500);
84+
85+
// assert: the overflow popover is closed.
86+
assert.strictEqual(overflowPopover.isDisplayedInViewport(), false,
87+
"Popover is closed.");
7088
});
7189

7290
it("tests if content is scrollable when tabcontainer takes limited height by its parent", () => {

0 commit comments

Comments
 (0)