-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Updated bar role from image to button based on the props to fix voice control issue in accessibility mode #36096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
374a473
e9e7c8f
b94c045
9639b2e
64d2e56
453a8c2
d757798
3d21570
f44e621
dc2891b
2ddac2c
1f54ba9
09411a4
57e6067
2e79b5b
2704593
49d3abb
149bf2b
830ac31
89465a6
bff02fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "Accessibility bug fix", | ||
| "packageName": "@fluentui/react-charts", | ||
| "email": "132879294+v-baambati@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,6 +280,8 @@ export const HorizontalBarChart: React.FunctionComponent<HorizontalBarChartProps | |
| const xValue = point.horizontalBarChartdata!.x; | ||
| const placeholderIndex = 1; | ||
| const isLegendSelected: boolean = _legendHighlighted(point.legend) || _noLegendHighlighted(); | ||
| const chartBarAriaLabel = _getAriaLabel(point).trim(); | ||
| const barAriaLabel = chartBarAriaLabel.length > 0 ? chartBarAriaLabel : 'Bar segment'; | ||
|
|
||
| // Render bar label instead of placeholder bar for absolute-scale variant | ||
| if (index === placeholderIndex && props.variant === HorizontalBarChartVariant.AbsoluteScale) { | ||
|
|
@@ -320,8 +322,9 @@ export const HorizontalBarChart: React.FunctionComponent<HorizontalBarChartProps | |
| _showToolTipOnSegment && point.legend !== '' ? event => _hoverOn(event, xValue, point) : undefined | ||
| } | ||
| onFocus={_showToolTipOnSegment && point.legend !== '' ? event => _hoverOn(event, xValue, point) : undefined} | ||
| role="img" | ||
| aria-label={_getAriaLabel(point)} | ||
| role="option" | ||
| aria-selected={isLegendSelected} | ||
| aria-label={barAriaLabel} | ||
| onBlur={_hoverOff} | ||
| onMouseLeave={_hoverOff} | ||
| className={classes.barWrapper} | ||
|
|
@@ -417,6 +420,7 @@ export const HorizontalBarChart: React.FunctionComponent<HorizontalBarChartProps | |
| props.variant === HorizontalBarChartVariant.AbsoluteScale ? null : _getChartDataText(points!); | ||
| const bars = _createBars(points!); | ||
| const keyVal = _uniqLineText + '_' + index; | ||
| const chartGroupAriaLabel = points!.chartTitle?.trim() ? points!.chartTitle : 'Horizontal bar chart data'; | ||
| // ToDo - Showtriangle property is per data series. How to account for it in the new stylesheet | ||
| /* const classes = useHorizontalBarChartStyles(props.styles!, { | ||
| width: props.width, | ||
|
|
@@ -440,7 +444,9 @@ export const HorizontalBarChart: React.FunctionComponent<HorizontalBarChartProps | |
| {points!.chartData![0].data && _createBenchmark(points!)} | ||
| <svg ref={barChartSvgRef} className={classes.chart} aria-label={points!.chartTitle}> | ||
| <g | ||
| role="listbox" | ||
| id={keyVal} | ||
| aria-label={chartGroupAriaLabel} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The outer svg already has aria label. Is aria label necessary here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes @AtishayMsft otherwise it is throwing error in fast pass tool. FFB Fix ONE of the following:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you try setting the title attribute
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes @AtishayMsft SVG element does not have title prop so it is forcing me to add aria label
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the aria-labelledby attribute of the outer containing svg element |
||
| ref={(e: SVGGElement) => { | ||
| _refCallback(e, points!.chartData![0].legend); | ||
| }} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.