File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
packages/bezier-react/src/components/AlphaIcon Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,20 @@ export const Icon = memo(
37
37
color,
38
38
source : SourceElement ,
39
39
style,
40
+ 'aria-hidden' : ariaHidden ,
41
+ 'aria-label' : ariaLabel ,
42
+ role = 'img' ,
40
43
...rest
41
44
} = marginRest
42
45
46
+ const isDecorative = ! ariaLabel && ariaHidden !== false
47
+
43
48
return (
44
49
< SourceElement
45
50
ref = { forwardedRef }
51
+ role = { role }
52
+ aria-hidden = { isDecorative }
53
+ aria-label = { ariaLabel }
46
54
style = {
47
55
{
48
56
'--b-icon-color' : alphaColorTokenCssVar ( color ) ,
Original file line number Diff line number Diff line change @@ -30,6 +30,21 @@ interface IconOwnProps {
30
30
* Color from the design system's functional or semantic color.
31
31
*/
32
32
color ?: FunctionalColor | SemanticColor
33
+ /**
34
+ * Accessible label for the icon
35
+ * @example "Close", "Menu", "More"
36
+ */
37
+ 'aria-label' ?: string
38
+ /**
39
+ * Whether to hide the icon from screen readers
40
+ * @default true when `aria-label` is not provided
41
+ */
42
+ 'aria-hidden' ?: boolean
43
+ /**
44
+ * ARIA role
45
+ * @default "img"
46
+ */
47
+ role ?: string
33
48
}
34
49
35
50
export interface IconProps
You can’t perform that action at this time.
0 commit comments