Updated bar role from image to button based on the props to fix voice control issue in accessibility mode#36096
Updated bar role from image to button based on the props to fix voice control issue in accessibility mode#36096v-baambati wants to merge 16 commits into
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
| @@ -320,13 +320,18 @@ export const HorizontalBarChart: React.FunctionComponent<HorizontalBarChartProps | |||
| _showToolTipOnSegment && point.legend !== '' ? event => _hoverOn(event, xValue, point) : undefined | |||
There was a problem hiding this comment.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Charts-DonutChart 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Charts-DonutChart.Dynamic - RTL.default.chromium.png | 5570 | Changed |
vr-tests-react-components/Positioning 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Positioning.Positioning end.chromium.png | 732 | Changed |
| vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png | 300 | Changed |
vr-tests-react-components/ProgressBar converged 3 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png | 34 | Changed |
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png | 84 | Changed |
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png | 68 | Changed |
…ay_2026BugFixes
…ay_2026BugFixes
…ay_2026BugFixes
…ay_2026BugFixes
|
|
||
| // Utility to check if a bar is interactive | ||
| const _isBarInteractive = (point: ChartDataPoint): boolean => { | ||
| return Boolean(point.onClick) || (!props.hideTooltip && point.legend !== ''); |
There was a problem hiding this comment.
This condition looks inconsistent across charts.
props.hideTooltip does not clearly represent interactivity. It only prevents the popover/callout from being shown.
Checking point.legend !== '' works for placeholder bars, but it could fail when a user intentionally sets the legend to an empty value for a real data series. Also, since we do not accept onClick or similar interaction props for placeholder bars, this additional check may not even be necessary.
I think we have two possible approaches:
interactive = typeof point.onClick === 'function'Or, if we want only highlighted bars to be clickable:
interactive =
(_legendHighlighted(point.legend!) || _noLegendHighlighted()) &&
typeof point.onClick === 'function'The 2nd option seems more appropriate but adopting it would require updating all charts to maintain consistent behavior across the library.
| onBlur={_onBarLeave} | ||
| fill={point.color && !useSingleColor ? point.color : colorScale(point.y)} | ||
| tabIndex={!props.hideTooltip && shouldHighlight ? 0 : undefined} | ||
| tabIndex={(!props.hideTooltip || point.onClick) && shouldHighlight ? 0 : undefined} |
There was a problem hiding this comment.
Did we agree to keep the tabIndex changes?

AccessibilityIssuesFix.mp4
BUG: https://office.visualstudio.com/OC/_workitems/edit/11472365