Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(CheckboxInput): use onMedia spinner shade when checked (#476)

Cindy Zhang20ca7eb1a988
diff --git a/packages/core/src/CheckboxInput/XDSCheckboxInput.test.tsx b/packages/core/src/CheckboxInput/XDSCheckboxInput.test.tsx
index c207d8a571..13e1617fc8 100644
--- a/packages/core/src/CheckboxInput/XDSCheckboxInput.test.tsx
+++ b/packages/core/src/CheckboxInput/XDSCheckboxInput.test.tsx
@@ -189,4 +189,16 @@ describe('XDSCheckboxInput', () => {
const label = screen.getByText('Accept terms');
expect(label).toBeVisible();
});
+
+ it('sets aria-busy when loading', () => {
+ render(
+ <XDSCheckboxInput
+ label="Accept terms"
+ value={false}
+ onChange={() => {}}
+ isLoading
+ />,
+ );
+ expect(screen.getByRole('checkbox')).toHaveAttribute('aria-busy', 'true');
+ });
});
diff --git a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
index b738cd1141..2d54de021f 100644
--- a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
+++ b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
@@ -405,7 +405,10 @@ export const XDSCheckboxInput = forwardRef<
styles.checkboxDisabledUnchecked,
)}>
{isBusy ? (
- <XDSSpinner size="sm" />
+ <XDSSpinner
+ size="sm"
+ shade={isCheckedOrIndeterminate ? 'onMedia' : 'default'}
+ />
) : (
<>
<svg