Skip to content

Commit c6fcf69

Browse files
authored
fix(ui5-tabcontainer): Fix ARIA posinset and setsize values (#2046)
The separator should be excluded, when calculating the aria-posinset and aria-setsize values. FIXES: #2035
1 parent 57be7c2 commit c6fcf69

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

packages/main/src/TabContainer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ class TabContainer extends UI5Element {
266266

267267
onBeforeRendering() {
268268
// Set external properties to items
269-
this.items.forEach((item, index) => {
269+
this.items.filter(item => !item.isSeparator).forEach((item, index, arr) => {
270270
item._isInline = this.tabLayout === TabLayout.Inline;
271271
item._mixedMode = this.mixedMode;
272272
item._posinset = index + 1;
273-
item._setsize = this.items.length;
273+
item._setsize = arr.length;
274274
item._getTabContainerHeaderItemCallback = _ => {
275275
return this.getDomRef().querySelector(`#${item._id}`);
276276
};

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

+11
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,15 @@ describe("TabContainer general interaction", () => {
109109
assert.ok(tabHeight < tabScrollHeight, "Tab Content is scrollable");
110110
assert.ok(tcHeight >= tcScrollHeight, "TabContainer is not scrollable scrollable");
111111
});
112+
113+
it("tests aria attrs", () => {
114+
const tabContainer = browser.$("#tabContainer1");
115+
const tab4 = tabContainer.shadow$(".ui5-tab-strip-item:nth-child(4)");
116+
117+
// assert: The TabContainer has 8 children, 7 tabs and 1 separator (at position 2)
118+
// and the separator should be skipped in terms of aria-posinset and aria-setsize,
119+
// so for child number 4 ("Monitors") we expect the following attributes aria-posinset="3" and aria-setsize="7".
120+
assert.strictEqual(tab4.getAttribute("aria-posinset"), "3", "The aria-posinset is correct.");
121+
assert.strictEqual(tab4.getAttribute("aria-setsize"), "7", "The aria-setsize is correct.");
122+
});
112123
});

0 commit comments

Comments
 (0)