nivo icon indicating copy to clipboard operation
nivo copied to clipboard

`Role` attribute for individual bars

Open JinCoreana opened this issue 1 year ago • 1 comments

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. Screenshot 2023-08-29 at 11 48 15

JinCoreana avatar Aug 29 '23 10:08 JinCoreana

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!

stale[bot] avatar Dec 15 '23 04:12 stale[bot]