Skip to content

Commit a060b8b

Browse files
authored
fix(popover): outsideClick should not fire on already-hidden popovers (#3101)
* 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> * docs: changeset
1 parent b1e3938 commit a060b8b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.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)