From 39b497817d4a4909c205aedaaad9885173666b8d Mon Sep 17 00:00:00 2001 From: krkshitij <110246001+krkshitij@users.noreply.github.com> Date: Fri, 27 Jan 2023 20:25:35 +0530 Subject: [PATCH] Fix duplicate-id accessibility issue in line chart (#26486) * fix duplicate-id accessibility issue in line chart * add change file --- ...-2f20f310-a538-4c9b-b93c-be8158fe1c65.json | 7 ++ .../components/LineChart/LineChart.base.tsx | 22 ++--- .../__snapshots__/LineChart.test.tsx.snap | 84 +++++++++---------- 3 files changed, 60 insertions(+), 53 deletions(-) create mode 100644 change/@fluentui-react-charting-2f20f310-a538-4c9b-b93c-be8158fe1c65.json diff --git a/change/@fluentui-react-charting-2f20f310-a538-4c9b-b93c-be8158fe1c65.json b/change/@fluentui-react-charting-2f20f310-a538-4c9b-b93c-be8158fe1c65.json new file mode 100644 index 00000000000000..9c394b8df7e91c --- /dev/null +++ b/change/@fluentui-react-charting-2f20f310-a538-4c9b-b93c-be8158fe1c65.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Fix duplicate-id accessibility issue in line chart", + "packageName": "@fluentui/react-charting", + "email": "kumarkshitij@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-charting/src/components/LineChart/LineChart.base.tsx b/packages/react-charting/src/components/LineChart/LineChart.base.tsx index 286b5746669600..1c93e3b9bd92fd 100644 --- a/packages/react-charting/src/components/LineChart/LineChart.base.tsx +++ b/packages/react-charting/src/components/LineChart/LineChart.base.tsx @@ -523,11 +523,11 @@ export class LineChartBase extends React.Component this._yAxisScale(d[1])) .curve(d3curveLinear); - const lineId = `${this._lineId}${i}`; - const borderId = `${this._borderId}${i}`; + const lineId = `${this._lineId}_${i}`; + const borderId = `${this._borderId}_${i}`; const strokeWidth = this._points[i].lineOptions?.strokeWidth || this.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE; @@ -664,9 +664,9 @@ export class LineChartBase extends React.Component diff --git a/packages/react-charting/src/components/LineChart/__snapshots__/LineChart.test.tsx.snap b/packages/react-charting/src/components/LineChart/__snapshots__/LineChart.test.tsx.snap index db3e2e223ec4bf..13f54797d71c2a 100644 --- a/packages/react-charting/src/components/LineChart/__snapshots__/LineChart.test.tsx.snap +++ b/packages/react-charting/src/components/LineChart/__snapshots__/LineChart.test.tsx.snap @@ -111,8 +111,8 @@ exports[`LineChart - mouse events Should render callout correctly on mouseover 1 />