Skip to content

Commit

Permalink
fix(ui5-li): correct accessible-name mappings (#5280)
Browse files Browse the repository at this point in the history
  • Loading branch information
dobrinyonkov authored May 30, 2022
1 parent 7fbb235 commit 21ed1ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/main/src/ListItem.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
aria-posinset="{{_accInfo.posinset}}"
aria-setsize="{{_accInfo.setsize}}"
aria-describedby="{{_id}}-invisibleText-describedby"
aria-labelledby="{{_id}}-invisibleText {{_id}}-content"
aria-labelledby="{{_accessibleNameRef}}"
aria-disabled="{{ariaDisabled}}"
>
{{> listItemPreContent}}
Expand Down
10 changes: 10 additions & 0 deletions packages/main/src/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,16 @@ class ListItem extends ListItemBase {
return ListItem.i18nBundle.getText(DELETE);
}

get _accessibleNameRef() {
if (this.accessibleName) {
// accessibleName is set - return labels excluding content
return `${this._id}-invisibleText`;
}

// accessibleName is not set - return _accInfo.listItemAriaLabel including content
return `${this._id}-content ${this._id}-invisibleText`;
}

get _accInfo() {
return {
role: this.accessibleRole || this.role,
Expand Down

0 comments on commit 21ed1ee

Please sign in to comment.