Skip to content

Commit d4ed883

Browse files
authored
WEBDEV-7740 Ensure tile hover panes are correctly positioned & skip showing if disconnected (#478)
* Include scroll distance in popover positioning * Only call showPopover if element is still connected to DOM
1 parent e50a163 commit d4ed883

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/tiles/hover/hover-pane-controller.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ export class HoverPaneController implements HoverPaneControllerInterface {
306306
}
307307
}
308308

309+
left += window.scrollX;
310+
top += window.scrollY;
311+
309312
return { left, top };
310313
}
311314

@@ -465,6 +468,10 @@ export class HoverPaneController implements HoverPaneControllerInterface {
465468
// Wait for the state update to render the hover pane
466469
await this.host.updateComplete;
467470

471+
// Ensure the hover pane element is still in the document before showing,
472+
// as it might have been removed by the previous update.
473+
if (!this.hoverPane?.isConnected) return;
474+
468475
this.hoverPane?.showPopover?.();
469476
await new Promise(resolve => {
470477
// Pane sizes aren't accurate until next frame

0 commit comments

Comments
 (0)