You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Popover open event triggers onclose handler.
To Reproduce
Steps to reproduce the behavior:
const{ isOpen, onClose, onToggle }=createDisclosure()return(<><Popoverplacement="right"opened={isOpen()}onClose={onClose}closeOnBlur={false}><PopoverTriggeras={Button}>{/* without e.stopPropagation() the Popover will open and close /*}<Buttonvariant="subtle"colorScheme="neutral"mr="$2"onClick={(e:MouseEvent)=>{onToggle();e.stopPropagation()}}>
Trigger
</Button></PopoverTrigger><PopoverContent><PopoverBody>Are you sure you want to have that milkshake?</PopoverBody></PopoverContent></Popover></>);
Expected behavior
If the open event should not trigger the close handler. => The Popover remains open.
Desktop (please complete the following information):
OS: [OSX]
Browser [Brave]
The text was updated successfully, but these errors were encountered:
Hi, you don't have to use createDisclosure and an inner Button to trigger the popover. PopoverTrigger is the button.
Your example should be written like this:
functionApp(){return(<><Popoverplacement="right"closeOnBlur={false}><PopoverTriggeras={Button}variant="subtle"colorScheme="neutral"mr="$2">
Trigger
</PopoverTrigger><PopoverContent><PopoverBody>
Are you sure you want to have that milkshake?
</PopoverBody></PopoverContent></Popover></>);}
The controlled syntax with createDisclosure is when you want an external button to control the popover:
functionControlledExample(){const{ isOpen, onClose, onToggle }=createDisclosure();return(<><Buttonvariant="subtle"colorScheme="neutral"mr="$2"onClick={onToggle}>
Trigger
</Button><Popoverplacement="right"opened={isOpen()}onClose={onClose}closeOnBlur={false}><PopoverTriggeras={Button}>Popover Target</PopoverTrigger><PopoverContent><PopoverArrow/><PopoverCloseButton/><PopoverHeader>Confirmation!</PopoverHeader><PopoverBody>Are you sure you want to have that milkshake?</PopoverBody></PopoverContent></Popover></>);}
Describe the bug
Popover open event triggers onclose handler.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
If the open event should not trigger the close handler. => The Popover remains open.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: