File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
projects/design-angular-kit/src/lib/components/utils/icon Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
- < svg [attr.aria-hidden] ="isAriaHidden " [attr.aria-label] ="labelWaria " [class] ="iconClass ">
1
+ < svg [attr.role] ="role " [attr.aria-hidden] ="isAriaHidden " [attr.aria-label] ="title || labelWaria " [class] ="iconClass ">
2
+ @if (title || labelWaria) {
3
+ < title > {{ title || labelWaria }}</ title >
4
+ }
2
5
< use [attr.href] ="iconHref " [attr.xlink:href] ="iconHref "> </ use >
3
6
</ svg >
Original file line number Diff line number Diff line change @@ -38,6 +38,16 @@ export class ItIconComponent {
38
38
*/
39
39
@Input ( ) svgClass : string | undefined ;
40
40
41
+ /**
42
+ * Title of the icon
43
+ */
44
+ @Input ( ) title : string | undefined ;
45
+
46
+ /**
47
+ * Custom Waria label
48
+ */
49
+ @Input ( ) labelWaria : string | undefined ;
50
+
41
51
/**
42
52
* Return the icon href
43
53
*/
@@ -71,13 +81,12 @@ export class ItIconComponent {
71
81
*/
72
82
protected assetBasePath : string ;
73
83
74
- /**
75
- * Custom Waria label
76
- */
77
- @Input ( ) labelWaria : string | undefined ;
78
-
79
84
get isAriaHidden ( ) : boolean {
80
- return this . labelWaria == undefined ;
85
+ return this . labelWaria == undefined && this . title == undefined ;
86
+ }
87
+
88
+ get role ( ) : string {
89
+ return this . labelWaria == undefined && this . title == undefined ? undefined : 'img' ;
81
90
}
82
91
83
92
constructor ( ) {
You can’t perform that action at this time.
0 commit comments