fix popover bug; closes #1911

This commit is contained in:
Cory LaViska
2025-12-30 11:31:44 -05:00
parent 56b1196265
commit 22dc34f467
3 changed files with 7 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
## Next
- Fixed a bug in `<wa-combobox>` that prevented the listbox from opening when options were preselected [issue:1883]
- Fixed a bug in `<wa-popup>` and `<wa-dropdown-item>` that caused an error when removing a popup while it was opening
## 3.1.0

View File

@@ -155,13 +155,13 @@ export default class WaDropdownItem extends WebAwesomeElement {
/** Opens the submenu. */
async openSubmenu() {
if (!this.hasSubmenu || !this.submenuElement) return;
if (!this.hasSubmenu || !this.submenuElement || !this.isConnected) return;
// Notify parent dropdown to handle positioning
this.notifyParentOfOpening();
// Use Popover API to show the submenu
this.submenuElement.showPopover();
this.submenuElement.showPopover?.();
this.submenuElement.hidden = false;
this.submenuElement.setAttribute('data-visible', '');
this.submenuOpen = true;
@@ -219,7 +219,7 @@ export default class WaDropdownItem extends WebAwesomeElement {
await animateWithClass(this.submenuElement, 'hide');
this.submenuElement.hidden = true;
this.submenuElement.removeAttribute('data-visible');
this.submenuElement.hidePopover();
this.submenuElement.hidePopover?.();
}
}

View File

@@ -286,11 +286,11 @@ export default class WaPopup extends WebAwesomeElement {
private start() {
// We can't start the positioner without an anchor
if (!this.anchorEl || !this.active) {
if (!this.anchorEl || !this.active || !this.isConnected) {
return;
}
this.popup.showPopover?.();
this.popup?.showPopover?.();
this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {
this.reposition();
@@ -299,7 +299,7 @@ export default class WaPopup extends WebAwesomeElement {
private async stop(): Promise<void> {
return new Promise(resolve => {
this.popup.hidePopover?.();
this.popup?.hidePopover?.();
if (this.cleanup) {
this.cleanup();