From bd3de5ed04a52e2178a48094e1543218cdfaa7f8 Mon Sep 17 00:00:00 2001 From: Application-drop-up Date: Sun, 6 Sep 2026 17:43:28 +0900 Subject: [PATCH 1/2] fix: prevent disabled Button rendered as an anchor from firing onClick internalOnClick only checked isLoading before invoking the user's onClick handler. A Button rendered as an with disabled set stays keyboard-operable (native elements ignore the disabled attribute), so Tab + Enter still fired onClick and navigated. Guard on disabled the same way isLoading is guarded, preventing the default action and skipping the handler. --- src/button/button.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/button/button.tsx b/src/button/button.tsx index 76dcb87b6b..4da14dd9c7 100644 --- a/src/button/button.tsx +++ b/src/button/button.tsx @@ -36,8 +36,8 @@ class Button extends React.Component< // @ts-ignore internalOnClick = (...args) => { - const { isLoading, onClick } = this.props; - if (isLoading) { + const { isLoading, disabled, onClick } = this.props; + if (isLoading || disabled) { args[0].preventDefault(); return; } From a91aeecab2ec24dc8558f094c035275fc2d46496 Mon Sep 17 00:00:00 2001 From: Application-drop-up Date: Sun, 6 Sep 2026 17:43:41 +0900 Subject: [PATCH 2/2] test: cover disabled anchor Button not firing onClick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression test for a disabled Button rendered as — clicking it (which is how Tab + Enter activates an anchor) must not call the provided onClick handler. --- src/button/__tests__/button.test.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/button/__tests__/button.test.tsx b/src/button/__tests__/button.test.tsx index e53101a9a0..810db0836c 100644 --- a/src/button/__tests__/button.test.tsx +++ b/src/button/__tests__/button.test.tsx @@ -57,6 +57,18 @@ describe('Button Component', () => { expect(onClick.mock.calls.length).toBe(0); }); + test("onClick doesn't fire on a disabled anchor button", () => { + const onClick = jest.fn(); + const { container } = render( + + ); + const anchor = container.querySelector('a'); + if (anchor) fireEvent.click(anchor); + expect(onClick.mock.calls.length).toBe(0); + }); + test('simulate isLoading with google translate does not throw with element child', () => { const { rerender, container } = render(