From d170d046a8a8868f316a3a4d6c74babcedf8efdd Mon Sep 17 00:00:00 2001 From: nicosammito Date: Sat, 10 Feb 2024 00:09:45 +0100 Subject: [PATCH] move buttonProps to div and remove it from trigger children --- src/components/popover/Popover.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/popover/Popover.tsx b/src/components/popover/Popover.tsx index 71f1f55b..270abae0 100644 --- a/src/components/popover/Popover.tsx +++ b/src/components/popover/Popover.tsx @@ -4,6 +4,7 @@ import {useOverlayTriggerState} from "react-stately"; import {getChild} from "../../utils/utils"; import {OverlayTriggerProps, PositionProps} from "@react-types/overlays"; import "./Popover.style.scss" +import {AriaButtonOptions} from "@react-aria/button"; export interface PopoverProps extends PositionProps, OverlayTriggerProps { children: React.ReactElement[] @@ -48,13 +49,13 @@ const Popover: React.FC = (props) => { }, state); - const {buttonProps} = useButton(triggerProps, triggerRef); + const {buttonProps} = useButton(triggerProps as AriaButtonOptions<'div'>, triggerRef); return ( <> -
- {popoverTrigger ? React.cloneElement(popoverTrigger?.props.children, buttonProps) : null} +
+ {popoverTrigger?.props.children}
{state.isOpen &&