mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
fix(use-aria-link): onclick deprecation warning for Button as Link (#4497)
This commit is contained in:
parent
33e0418d08
commit
b2e924fe19
5
.changeset/sixty-fireants-build.md
Normal file
5
.changeset/sixty-fireants-build.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@nextui-org/use-aria-link": patch
|
||||
---
|
||||
|
||||
fix onclick deprecation warning for Button as Link (#4493)
|
||||
@ -19,6 +19,8 @@ export interface AriaLinkOptions extends AriaLinkProps {
|
||||
"aria-current"?: DOMAttributes["aria-current"];
|
||||
/** Whether the link is disabled. */
|
||||
isDisabled?: boolean;
|
||||
/** The role of the element */
|
||||
role?: string;
|
||||
/**
|
||||
* The HTML element used to render the link, e.g. 'a', or 'span'.
|
||||
* @default 'a'
|
||||
@ -46,6 +48,7 @@ export function useAriaLink(props: AriaLinkOptions, ref: RefObject<FocusableElem
|
||||
onPressEnd,
|
||||
// @ts-ignore
|
||||
onClick: deprecatedOnClick,
|
||||
role,
|
||||
isDisabled,
|
||||
...otherProps
|
||||
} = props;
|
||||
@ -61,7 +64,7 @@ export function useAriaLink(props: AriaLinkOptions, ref: RefObject<FocusableElem
|
||||
|
||||
let isMobile = isIOS() || isAndroid();
|
||||
|
||||
if (deprecatedOnClick && typeof deprecatedOnClick === "function") {
|
||||
if (deprecatedOnClick && typeof deprecatedOnClick === "function" && role !== "button") {
|
||||
warn(
|
||||
"onClick is deprecated, please use onPress instead. See: https://github.com/nextui-org/nextui/issues/4292",
|
||||
"useLink",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user