Skip to content

Commit

Permalink
fix(ui5-li-groupheader): change role option (#3869)
Browse files Browse the repository at this point in the history
  • Loading branch information
dobrinyonkov authored and fifoosid committed Sep 9, 2021
1 parent d73bba1 commit b6219c7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/main/src/GroupHeaderListItem.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
@focusin="{{_onfocusin}}"
@focusout="{{_onfocusout}}"
@keydown="{{_onkeydown}}"
role="option"
aria-label="{{ariaLabelText}}"
aria-roledescription="{{groupHeaderText}}"
role="group"
style="list-style-type: none;"
>
<span class="ui5-hidden-text">{{groupHeaderText}} {{accessibleName}}</span>

<div id="{{_id}}-content" class="ui5-li-content">
<span class="ui5-ghli-title"><slot></slot></span>
</div>
Expand Down
4 changes: 4 additions & 0 deletions packages/main/src/GroupHeaderListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class GroupHeaderListItem extends ListItemBase {
return this.i18nBundle.getText(GROUP_HEADER_TEXT);
}

get ariaLabelText() {
return [this.textContent, this.accessibleName].filter(Boolean).join(" ");
}

static async onDefine() {
await Promise.all([
fetchI18nBundle("@ui5/webcomponents"),
Expand Down
1 change: 1 addition & 0 deletions packages/main/test/pages/List_test_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

<br><br><br>
<ui5-list id="listSelectedItem" mode="MultiSelect">
<ui5-li-groupheader id="group-header">New Items</ui5-li-groupheader>
<ui5-li id="not-selected-country">Argentina</ui5-li>
<ui5-li id="selected-country" selected >Bulgaria</ui5-li>
</ui5-list>
Expand Down
6 changes: 6 additions & 0 deletions packages/main/test/specs/List.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,4 +369,10 @@ describe("List Tests", () => {
accInfo = selectedItem.getProperty("_accInfo");
assert.strictEqual(accInfo.listItemAriaLabel, "Selected", "Selected text is part of the label");
});

it('group headers should not be with role options', () => {
const groupHeader = $("#listSelectedItem #group-header").shadow$(".ui5-ghli-root");

assert.strictEqual(groupHeader.getAttribute("role"), "group", "Item label is empty");
});
});

0 comments on commit b6219c7

Please sign in to comment.