From 051b0da7500f77e4b03d8630c8e51cb5b15b11ce Mon Sep 17 00:00:00 2001 From: Shreyag02 Date: Fri, 16 Oct 2026 13:59:34 +0530 Subject: [PATCH] fix: [indicator] default the fallback label to the accent variant --- .../indicator/__tests__/indicator.test.tsx | 17 +++++++++++++++++ .../react/components/indicator/indicator.tsx | 6 ++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/react/components/indicator/__tests__/indicator.test.tsx b/packages/react/components/indicator/__tests__/indicator.test.tsx index b557ce354..0d380838c 100644 --- a/packages/react/components/indicator/__tests__/indicator.test.tsx +++ b/packages/react/components/indicator/__tests__/indicator.test.tsx @@ -64,4 +64,21 @@ describe('Indicator', () => { expect(dot).toBeInTheDocument(); }); }); + + describe('Accessibility', () => { + it('labels the badge with the default variant', () => { + render(); + expect(screen.getByRole('status')).toHaveAttribute( + 'aria-label', + 'accent indicator' + ); + }); + + it('treats a null variant as accent', () => { + render(); + const badge = screen.getByRole('status'); + expect(badge).toHaveAttribute('aria-label', 'accent indicator'); + expect(badge).toHaveClass(styles['indicator-variant-accent']); + }); + }); }); diff --git a/packages/react/components/indicator/indicator.tsx b/packages/react/components/indicator/indicator.tsx index e6dbbe29d..58c113d32 100644 --- a/packages/react/components/indicator/indicator.tsx +++ b/packages/react/components/indicator/indicator.tsx @@ -45,7 +45,9 @@ export const Indicator = ({ 'aria-label': ariaLabel, ...props }: IndicatorProps) => { - const accessibilityLabel = ariaLabel || label || `${variant} indicator`; + const resolvedVariant = variant ?? 'accent'; + const accessibilityLabel = + ariaLabel || label || `${resolvedVariant} indicator`; return (
{children}