Skip to content

Commit 418fbe9

Browse files
fix: add field name in aria label for pie and donut chart (#1993)
* fix: add field name in aria label for pie and donut chart * fix: review comments * fix: review comments --------- Co-authored-by: Rishabh Sharma <[email protected]>
1 parent 91799a0 commit 418fbe9

File tree

1 file changed

+9
-7
lines changed
  • packages/core/src/components/graphs

1 file changed

+9
-7
lines changed

packages/core/src/components/graphs/pie.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ export class Pie extends Component {
123123
// a11y
124124
.attr('role', Roles.GRAPHICS_SYMBOL)
125125
.attr('aria-roledescription', 'slice')
126-
.attr(
127-
'aria-label',
128-
(d: any) =>
129-
`${d[valueMapsTo]}, ${
130-
convertValueToPercentage(d.data[valueMapsTo], displayData, valueMapsTo) + '%'
131-
}`
132-
)
126+
.attr('aria-label', (d: any) => {
127+
return [
128+
d[valueMapsTo],
129+
convertValueToPercentage(d.data[valueMapsTo], displayData, valueMapsTo) + '%',
130+
d.data[groupMapsTo]
131+
]
132+
.filter(Boolean)
133+
.join(', ')
134+
})
133135
// Tween
134136
.attrTween('d', function (a: any) {
135137
return arcTween.bind(this)(a, self.arc)

0 commit comments

Comments
 (0)