Skip to content

Commit 4bb84e1

Browse files
authored
feat(ui5-icon): add accessibility role (#3407)
1 parent c5e00c4 commit 4bb84e1

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

packages/main/src/Icon.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
tabindex="{{tabIndex}}"
44
dir="{{_dir}}"
55
viewBox="0 0 512 512"
6-
role="{{role}}"
6+
role="{{effectiveAccessibleRole}}"
77
focusable="false"
88
preserveAspectRatio="xMidYMid meet"
99
aria-label="{{effectiveAccessibleName}}"

packages/main/src/Icon.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ const metadata = {
8585
type: Boolean,
8686
},
8787

88+
/**
89+
* Defines the accessibility role of the component.
90+
* @defaultvalue ""
91+
* @private
92+
* @since 1.0.0-rc.15
93+
*/
94+
role: {
95+
type: String,
96+
},
97+
8898
/**
8999
* @private
90100
*/
@@ -251,7 +261,11 @@ class Icon extends UI5Element {
251261
return this.interactive ? "0" : "-1";
252262
}
253263

254-
get role() {
264+
get effectiveAccessibleRole() {
265+
if (this.role) {
266+
return this.role;
267+
}
268+
255269
if (this.interactive) {
256270
return "button";
257271
}

0 commit comments

Comments
 (0)