fix: use i18n for aria-label and always set it in pie chart

- Replace hardcoded aria-label string with @grafana/i18n translation
- Always set aria-label instead of conditionally setting to undefined
- Addresses review feedback on internationalization and accessibility
This commit is contained in:
Abhijnya002
2026-01-06 19:09:22 -05:00
parent eb3df4fa00
commit 45bdeefbdf
@@ -18,6 +18,7 @@ import {
DataHoverEvent,
} from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
import { t } from '@grafana/i18n';
import { SortOrder, VizTooltipOptions } from '@grafana/schema';
import {
useTheme2,
@@ -500,7 +501,7 @@ function PieSlice({
onClick={openMenu}
tabIndex={shouldBeFocusable ? 0 : -1}
role={shouldBeFocusable ? 'link' : undefined}
aria-label={shouldBeFocusable ? `${arc.data.display.title} - Data link` : undefined}
aria-label={t('piechart.data-link-label', '{{title}} - Data link', { title: arc.data.display.title })}
onKeyDown={shouldBeFocusable ? handleKeyDown : undefined}
onFocus={hasDataLinks ? handleFocus : undefined}
onBlur={hasDataLinks ? handleBlur : undefined}