Skip to content

Commit e01af4a

Browse files
committed
Delay changing popover display
Previously would make the popover visible and then reposition it on the next frame in order to avoid getting called recursively due to the observer, however this causes the scrollbar to appear if it wasn't already visible for a single frame which is janky. This change fixes that.
1 parent 3043a0b commit e01af4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/glance/static/js/popover.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ function showPopover() {
9898
}
9999

100100
contentElement.style.maxWidth = contentMaxWidth;
101-
containerElement.style.display = "block";
102101
activeTarget.classList.add("popover-active");
103102
document.addEventListener("keydown", handleHidePopoverOnEscape);
104103
window.addEventListener("resize", queueRepositionContainer);
105104
observer.observe(containerElement);
106105
}
107106

108107
function repositionContainer() {
108+
containerElement.style.display = "block";
109+
109110
const targetBounds = activeTarget.dataset.popoverAnchor !== undefined
110111
? activeTarget.querySelector(activeTarget.dataset.popoverAnchor).getBoundingClientRect()
111112
: activeTarget.getBoundingClientRect();

0 commit comments

Comments
 (0)