Skip to content

Commit f9a169d

Browse files
committed
fix(popover): outsideClick should not fire on already-hidden popovers
Guard the outsideClick handler to skip popovers that are already hidden, preventing spurious hide/hidden events on closed popovers when clicking anywhere on the page. Closes #2513 Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1377f14 commit f9a169d

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

.changeset/fix-popover-click.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@patternfly/elements": patch
3+
---
4+
5+
`pf-popover`: clicking outside a popover no longer fires spurious
6+
hide events on other closed popovers.

elements/pf-popover/pf-popover.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ export class PfPopover extends LitElement {
351351
};
352352

353353
#outsideClick(event: MouseEvent) {
354+
if (this.#hideDialog) {
355+
return;
356+
}
354357
const path = event.composedPath();
355358
if (!path.includes(this) && !path.includes(this.#referenceTrigger as HTMLElement)) {
356359
this.hide();

0 commit comments

Comments
 (0)