Skip to content

Updated bar role from image to button based on the props to fix voice control issue in accessibility mode#36096

Open
v-baambati wants to merge 16 commits into
microsoft:masterfrom
v-baambati:May_2026BugFixes
Open

Updated bar role from image to button based on the props to fix voice control issue in accessibility mode#36096
v-baambati wants to merge 16 commits into
microsoft:masterfrom
v-baambati:May_2026BugFixes

Conversation

@v-baambati
Copy link
Copy Markdown
Contributor

@v-baambati v-baambati commented May 5, 2026

@v-baambati v-baambati requested a review from a team as a code owner May 5, 2026 08:21
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-charts
DeclarativeChart
754.301 kB
220.353 kB
754.626 kB
220.499 kB
325 B
146 B
react-charts
GroupedVerticalBarChart
394.458 kB
123.191 kB
394.513 kB
123.217 kB
55 B
26 B
react-charts
HorizontalBarChart
293.624 kB
89.351 kB
293.717 kB
89.393 kB
93 B
42 B
react-charts
VerticalBarChart
430.939 kB
128.044 kB
431.044 kB
128.072 kB
105 B
28 B
react-charts
VerticalStackedBarChart
400.527 kB
124.592 kB
400.637 kB
124.647 kB
110 B
55 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-charts
AreaChart
403.481 kB
126.159 kB
react-charts
DonutChart
313.894 kB
96.752 kB
react-charts
FunnelChart
305.441 kB
93.588 kB
react-charts
GanttChart
386.58 kB
120.45 kB
react-charts
GaugeChart
313.327 kB
96.198 kB
react-charts
HeatMapChart
388.661 kB
121.568 kB
react-charts
HorizontalBarChartWithAxis
63 B
83 B
react-charts
Legends
233.155 kB
70.126 kB
react-charts
LineChart
414.815 kB
129.027 kB
react-charts
PolarChart
342.29 kB
106.689 kB
react-charts
SankeyChart
210.155 kB
67.111 kB
react-charts
ScatterChart
394.197 kB
123.166 kB
react-charts
Sparkline
80.503 kB
26.644 kB
🤖 This report was generated against 149069a47f0e2d84c34f4f2558ab9e5f836575d6

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Pull request demo site: URL

@@ -320,13 +320,18 @@ export const HorizontalBarChart: React.FunctionComponent<HorizontalBarChartProps
_showToolTipOnSegment && point.legend !== '' ? event => _hoverOn(event, xValue, point) : undefined
Copy link
Copy Markdown

@github-actions github-actions Bot May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ 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


// Utility to check if a bar is interactive
const _isBarInteractive = (point: ChartDataPoint): boolean => {
return Boolean(point.onClick) || (!props.hideTooltip && point.legend !== '');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AtishayMsft your inputs on this?

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}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we agree to keep the tabIndex changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants