File tree 3 files changed +10
-5
lines changed
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ test('Matches shallow shapshot', () => {
8
8
renderer . render ( (
9
9
< Item
10
10
currentSubMenuTitle = "title"
11
- icon = "icon url"
11
+ icon = { < div /> }
12
12
title = "title"
13
13
link = "menu url"
14
14
/>
@@ -18,7 +18,7 @@ test('Matches shallow shapshot', () => {
18
18
renderer . render ( (
19
19
< Item
20
20
currentSubMenuTitle = "another title"
21
- icon = "icon url"
21
+ icon = { < div /> }
22
22
title = "title"
23
23
link = "menu url"
24
24
/>
Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ exports[`Matches shallow shapshot 1`] = `
11
11
openNewTab = { false }
12
12
to = " menu url"
13
13
>
14
- icon url
14
+ <div
15
+ aria-label = " title"
16
+ />
15
17
title
16
18
</Link >
17
19
</li >
@@ -28,7 +30,9 @@ exports[`Matches shallow shapshot 2`] = `
28
30
openNewTab = { false }
29
31
to = " menu url"
30
32
>
31
- icon url
33
+ <div
34
+ aria-label = " title"
35
+ />
32
36
title
33
37
</Link >
34
38
</li >
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export default function Item({
18
18
} ) {
19
19
let styleName = 'item' ;
20
20
if ( currentSubMenuTitle === title ) styleName += ' current' ;
21
+ const accessibleIcon = React . cloneElement ( icon , { 'aria-label' : `${ title } ` } ) ;
21
22
return (
22
23
/* TODO: Should be done in a clean way, witout disabling eslint rules. */
23
24
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
@@ -29,7 +30,7 @@ export default function Item({
29
30
tabIndex = { 0 }
30
31
>
31
32
< Link enforceA = { enforceA } openNewTab = { openNewTab } to = { link } >
32
- { icon }
33
+ { accessibleIcon }
33
34
{ title }
34
35
</ Link >
35
36
</ li >
You can’t perform that action at this time.
0 commit comments