Skip to content

Commit a6f7b46

Browse files
authored
Mark MaterialIcon as hidden if it has no label (#6951)
This prevents the icon's ID being treated as text in some scenarios.
1 parent 62f306d commit a6f7b46

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

site/lib/src/components/material_icon.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ class MaterialIcon extends StatelessComponent {
2626
classes: ['material-symbols', ...classes].toClasses,
2727
attributes: {
2828
'title': ?title,
29-
'aria-label': ?(label ?? title),
29+
if (label ?? title case final labelToUse?)
30+
'aria-label': labelToUse
31+
else
32+
'aria-hidden': 'true',
3033
'translate': 'no',
3134
},
3235
[text(id)],

0 commit comments

Comments
 (0)