Skip to content

Commit

Permalink
feat(ui5-icon): add accessibility role (#3407)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnaydenow authored Jun 10, 2021
1 parent c5e00c4 commit 4bb84e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/main/src/Icon.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
tabindex="{{tabIndex}}"
dir="{{_dir}}"
viewBox="0 0 512 512"
role="{{role}}"
role="{{effectiveAccessibleRole}}"
focusable="false"
preserveAspectRatio="xMidYMid meet"
aria-label="{{effectiveAccessibleName}}"
Expand Down
16 changes: 15 additions & 1 deletion packages/main/src/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ const metadata = {
type: Boolean,
},

/**
* Defines the accessibility role of the component.
* @defaultvalue ""
* @private
* @since 1.0.0-rc.15
*/
role: {
type: String,
},

/**
* @private
*/
Expand Down Expand Up @@ -251,7 +261,11 @@ class Icon extends UI5Element {
return this.interactive ? "0" : "-1";
}

get role() {
get effectiveAccessibleRole() {
if (this.role) {
return this.role;
}

if (this.interactive) {
return "button";
}
Expand Down

0 comments on commit 4bb84e1

Please sign in to comment.