From e01af4adec3d6aa2e2e7fbbc79c8af8e36833f37 Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Sat, 15 Feb 2025 13:53:13 +0000 Subject: [PATCH] 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. --- internal/glance/static/js/popover.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/glance/static/js/popover.js b/internal/glance/static/js/popover.js index 91c69e3..331ee26 100644 --- a/internal/glance/static/js/popover.js +++ b/internal/glance/static/js/popover.js @@ -98,7 +98,6 @@ function showPopover() { } contentElement.style.maxWidth = contentMaxWidth; - containerElement.style.display = "block"; activeTarget.classList.add("popover-active"); document.addEventListener("keydown", handleHidePopoverOnEscape); window.addEventListener("resize", queueRepositionContainer); @@ -106,6 +105,8 @@ function showPopover() { } function repositionContainer() { + containerElement.style.display = "block"; + const targetBounds = activeTarget.dataset.popoverAnchor !== undefined ? activeTarget.querySelector(activeTarget.dataset.popoverAnchor).getBoundingClientRect() : activeTarget.getBoundingClientRect();