diff --git a/packages/overlays/src/components/popover.gts b/packages/overlays/src/components/popover.gts index adce4cde..b195c3ab 100644 --- a/packages/overlays/src/components/popover.gts +++ b/packages/overlays/src/components/popover.gts @@ -65,7 +65,13 @@ interface PopoverSignature { }>; Content: WithBoundArgs< typeof Content, - 'loop' | 'isOpen' | 'id' | 'toggle' | 'blockScroll' | 'backdrop' + | 'loop' + | 'isOpen' + | 'id' + | 'toggle' + | 'internalDidClose' + | 'blockScroll' + | 'backdrop' >; } ]; @@ -76,6 +82,7 @@ class Popover extends Component { triggerEl?: HTMLElement; menuId = guidFor(this); @tracked _isOpen = false; + @tracked isClosing = false; get isOpen(): boolean { if ( @@ -97,6 +104,9 @@ class Popover extends Component { }; open = () => { + if (this.isClosing) { + return; + } if (typeof this.args.onOpenChange === 'function') { this.args.onOpenChange(true); } else { @@ -105,6 +115,7 @@ class Popover extends Component { }; close = () => { + this.isClosing = true; if (typeof this.args.onOpenChange === 'function') { this.args.onOpenChange(false); } else { @@ -147,6 +158,10 @@ class Popover extends Component { } }); + didClose = () => { + this.isClosing = false; + }; +