Skip to content

Commit

Permalink
move buttonProps to div and remove it from trigger children
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosammito committed Feb 9, 2024
1 parent ffeee18 commit d170d04
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<PopoverTriggerType & PopoverContentType>[]
Expand Down Expand Up @@ -48,13 +49,13 @@ const Popover: React.FC<PopoverProps> = (props) => {
}, state);


const {buttonProps} = useButton(triggerProps, triggerRef);
const {buttonProps} = useButton(triggerProps as AriaButtonOptions<'div'>, triggerRef);


return (
<>
<div ref={triggerRef}>
{popoverTrigger ? React.cloneElement(popoverTrigger?.props.children, buttonProps) : null}
<div ref={triggerRef} {...buttonProps}>
{popoverTrigger?.props.children}
</div>

{state.isOpen &&
Expand Down

0 comments on commit d170d04

Please sign in to comment.