فهرست منبع

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.
Svilen Markov 5 ماه پیش
والد
کامیت
e01af4adec
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      internal/glance/static/js/popover.js

+ 2 - 1
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();