Skip to content

Commit 8192abf

Browse files
authored
fix: avoid triggering onClick on disabled links
Fixes #8827
1 parent d434b6d commit 8192abf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/@react-aria/link/src/useLink.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement
7171
'aria-disabled': isDisabled || undefined,
7272
'aria-current': props['aria-current'],
7373
onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {
74+
if (isDisabled) {
75+
return;
76+
}
7477
pressProps.onClick?.(e);
7578
handleLinkClick(e, router, props.href, props.routerOptions);
7679
}

0 commit comments

Comments
 (0)