Skip to content

Commit 164c170

Browse files
committed
Fix: Trigger popover update on slot content change
Adds a slotchange event handler to the slot in UUIPopoverContainerElement. This ensures the popover updates when its slotted content changes by calling #initUpdate within a requestAnimationFrame.
1 parent 53475b5 commit 164c170

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/uui-popover-container/lib/uui-popover-container.element.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,14 @@ export class UUIPopoverContainerElement extends LitElement {
351351
this.#scrollParents.push(document.body);
352352
}
353353

354+
#onSlotChange() {
355+
requestAnimationFrame(() => {
356+
this.#initUpdate();
357+
});
358+
}
359+
354360
render() {
355-
return html`<slot></slot>`;
361+
return html`<slot @slotchange=${this.#onSlotChange}></slot>`;
356362
}
357363

358364
static styles = [

0 commit comments

Comments
 (0)