Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand Up @@ -399,7 +399,7 @@ describe('Grouped vertical bar chart - Subcomponent bar', () => {
{ data: chartPoints, barWidth: 'auto', maxBarWidth: 50 },
container => {
// Assert
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
expect(bars).toHaveLength(6);
expect(bars[0].getAttribute('width')).toEqual('50');
expect(bars[1].getAttribute('width')).toEqual('50');
Expand All @@ -414,7 +414,7 @@ describe('Grouped vertical bar chart - Subcomponent bar', () => {
container => {
// colors mentioned in the data points itself
// Assert
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
expect(bars[0].getAttribute('fill')).toEqual('#00bcf2');
expect(bars[1].getAttribute('fill')).toEqual('#0078d4');
expect(bars[2].getAttribute('fill')).toEqual('#00bcf2');
Expand All @@ -440,7 +440,7 @@ describe('Grouped vertical bar chart - Subcomponent bar', () => {
{ data: accessibilityDataPoints },
container => {
// Assert
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
expect(bars[0]).toHaveAttribute(
'aria-label',
'Group series 1 of 4, Bar series 1 of 2 x-Axis 2020/04/30 MetaData1 33%',
Expand Down Expand Up @@ -473,7 +473,7 @@ describe('Grouped vertical bar chart - Subcomponent Legends', () => {
//const legends = getByClass(container, /legend-/i);
const legends = screen.getAllByText((content, element) => element!.tagName.toLowerCase() === 'button');
fireEvent.mouseOver(legends[0]);
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
// Assert
expect(bars[0]).toHaveAttribute('opacity', '');
expect(bars[1]).toHaveAttribute('opacity', '0.1');
Expand All @@ -491,7 +491,7 @@ describe('Grouped vertical bar chart - Subcomponent Legends', () => {
container => {
const legends = screen.getAllByText((content, element) => element!.tagName.toLowerCase() === 'button');
fireEvent.mouseOver(legends[0]);
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
// Assert
expect(bars[0]).toHaveAttribute('opacity', '');
expect(bars[1]).toHaveAttribute('opacity', '0.1');
Expand All @@ -500,7 +500,7 @@ describe('Grouped vertical bar chart - Subcomponent Legends', () => {
expect(bars[4]).toHaveAttribute('opacity', '');
expect(bars[5]).toHaveAttribute('opacity', '0.1');
fireEvent.mouseOver(legends[1]);
const updatedBars = container.querySelectorAll('rect[role="img"]');
const updatedBars = container.querySelectorAll('rect[role="button"]');
// Assert
expect(updatedBars[0]).toHaveAttribute('opacity', '0.1');
expect(updatedBars[1]).toHaveAttribute('opacity', '');
Expand All @@ -521,7 +521,7 @@ describe('Grouped vertical bar chart - Subcomponent Legends', () => {
const legendsAfterClickEvent = screen.getAllByText(
(content, element) => element!.tagName.toLowerCase() === 'button',
);
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
// Assert
expect(legendsAfterClickEvent[0]).toHaveAttribute('aria-selected', 'true');
expect(legendsAfterClickEvent[1]).toHaveAttribute('aria-selected', 'false');
Expand All @@ -545,7 +545,7 @@ describe('Grouped vertical bar chart - Subcomponent Legends', () => {
const legendsAfterClickEvent = screen.getAllByText(
(content, element) => element!.tagName.toLowerCase() === 'button',
);
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
// Assert
expect(legendsAfterClickEvent[0]).toHaveAttribute('aria-selected', 'false');
expect(legendsAfterClickEvent[1]).toHaveAttribute('aria-selected', 'false');
Expand Down Expand Up @@ -576,7 +576,7 @@ describe('Grouped vertical bar chart - Subcomponent Legends', () => {
expect(firstLegend).toHaveAttribute('aria-selected', 'true');
expect(secondLegend).toHaveAttribute('aria-selected', 'true');

const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
expect(bars[0]).toHaveAttribute('opacity', '0.1');
expect(bars[1]).toHaveAttribute('opacity', '');
expect(bars[2]).toHaveAttribute('opacity', '');
Expand Down Expand Up @@ -729,7 +729,7 @@ describe('GroupedVerticalBarChart - mouse events', () => {

it('Should render callout correctly on mouseover', async () => {
const { container } = render(<GroupedVerticalBarChart data={chartPoints} calloutProps={{}} />);
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
fireEvent.mouseOver(bars[0]);
// Wait for any async updates (if needed)
act(() => {
Expand All @@ -740,7 +740,7 @@ describe('GroupedVerticalBarChart - mouse events', () => {

it('Should render callout correctly on mousemove', () => {
const { container } = render(<GroupedVerticalBarChart data={chartPoints} />);
const bars = container.querySelectorAll('rect[role="img"]');
const bars = container.querySelectorAll('rect[role="button"]');
fireEvent.mouseMove(bars[2]);
const html1 = container.innerHTML;
fireEvent.mouseMove(bars[3]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export const GroupedVerticalBarChart: React.FC<GroupedVerticalBarChartProps> = R
onClick={pointData.onClick}
aria-label={getAriaLabel(pointData, singleSet.xAxisPoint)}
tabIndex={_legendHighlighted(pointData.legend) || _noLegendHighlighted() ? 0 : undefined}
role="img"
role="button"
/>,
);

Expand Down Expand Up @@ -871,7 +871,7 @@ export const GroupedVerticalBarChart: React.FC<GroupedVerticalBarChartProps> = R
tabIndex={shouldHighlight ? 0 : undefined}
onFocus={e => _onLineFocus(e, series, seriesIdx, pointIdx)}
onBlur={_onBarLeave}
role="img"
role="button"
aria-label={getAriaLabel(
{
xAxisCalloutData: point.xAxisCalloutData,
Expand Down
Loading
Loading