Skip to content

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

TypeScript

fix(core): expose aria-busy on link-rendered Button loading state (#3985)

Baraa Hamodi43269c54f9f5
diff --git a/.changeset/button-link-aria-busy.md b/.changeset/button-link-aria-busy.md
new file mode 100644
index 0000000000..f6d981affb
--- /dev/null
+++ b/.changeset/button-link-aria-busy.md
@@ -0,0 +1,6 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] Button: link-rendered buttons (`href`) now expose `aria-busy` while loading, matching the `<button>` branch. Previously an interruptible loading link showed the spinner and announced "Loading" but carried no machine-readable busy state.
+@bhamodi
diff --git a/packages/core/src/Button/Button.test.tsx b/packages/core/src/Button/Button.test.tsx
index adceca6c6e..390ff1584b 100644
--- a/packages/core/src/Button/Button.test.tsx
+++ b/packages/core/src/Button/Button.test.tsx
@@ -445,4 +445,25 @@ describe('Button', () => {
rerender(<Button label="Submit" isLoading />);
expect(liveRegion).toHaveTextContent('Loading');
});
+
+ it('exposes aria-busy on the link-rendered button while loading', () => {
+ // Non-interruptible loading disables the button, which falls back to
+ // <button> rendering — so an anchor only shows loading when interruptible.
+ render(
+ <Button
+ label="Docs"
+ href="https://example.com"
+ isLoading
+ isInterruptible
+ />,
+ );
+ const link = screen.getByRole('link');
+ expect(link).toHaveAttribute('aria-busy', 'true');
+ });
+
+ it('does not set aria-busy on the link-rendered button when not loading', () => {
+ render(<Button label="Docs" href="https://example.com" />);
+ const link = screen.getByRole('link');
+ expect(link).not.toHaveAttribute('aria-busy');
+ });
});
diff --git a/packages/core/src/Button/Button.tsx b/packages/core/src/Button/Button.tsx
index f84f85ae45..a16cd35b7c 100644
--- a/packages/core/src/Button/Button.tsx
+++ b/packages/core/src/Button/Button.tsx
@@ -786,6 +786,7 @@ export function Button({
{...ariaLabelProp}
{...describedByProp}
{...edgeCompAttr}
+ aria-busy={isLoadingState || undefined}
onClick={handleClick}>
{buttonContent}
</LinkComponent>