nivo
nivo copied to clipboard
`Role` attribute for individual bars
Is your feature request related to a problem? Please describe.
I am using ResponvieBar
component and found that role
attribute does not get inherited to the <rect>
of the individual bars whilst I can pass aria-label
to them using barAriaLabel
attribute. I believe role and aria-label should be paired up in this case.
Describe the solution you'd like
Please inherit role to the children <rect>
or enable another prop like barRole
to manually assign role to each bar.
Describe alternatives you've considered
I have implemented a workaround that override bars by passing the below CustomBars
component to layers attribute instead of the default bars
But I wish this can be done automatically.
const CustomBars = (props: { bars: ComputedBarDatum<BarDatum>[] }) => (
<>
{props.bars.map((bar) => {
return (
<rect
{...bar}
key={bar.key}
role="figure"
fill={bar.color}
aria-label={bar.label}
tabIndex={0}
/>
);
})}
</>
);
Additional context
Here is the assesibility assessment taken in the official nivo doc and I could check the same issue occurs.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!