mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 18:31:24 +02:00
Fix observer console errors
This commit is contained in:
parent
ec9d455d18
commit
d400b27545
@ -439,7 +439,7 @@ function setupCollapsibleGrids() {
|
|||||||
|
|
||||||
let cardsPerRow;
|
let cardsPerRow;
|
||||||
|
|
||||||
const resolveCollapsibleItems = () => {
|
const resolveCollapsibleItems = () => requestAnimationFrame(() => {
|
||||||
const hideItemsAfterIndex = cardsPerRow * collapseAfterRows;
|
const hideItemsAfterIndex = cardsPerRow * collapseAfterRows;
|
||||||
|
|
||||||
if (hideItemsAfterIndex >= gridElement.children.length) {
|
if (hideItemsAfterIndex >= gridElement.children.length) {
|
||||||
@ -465,7 +465,7 @@ function setupCollapsibleGrids() {
|
|||||||
child.style.removeProperty("animation-delay");
|
child.style.removeProperty("animation-delay");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
const observer = new ResizeObserver(() => {
|
const observer = new ResizeObserver(() => {
|
||||||
if (!isElementVisible(gridElement)) {
|
if (!isElementVisible(gridElement)) {
|
||||||
|
@ -25,7 +25,8 @@ frameElement.append(contentElement);
|
|||||||
containerElement.append(frameElement);
|
containerElement.append(frameElement);
|
||||||
document.body.append(containerElement);
|
document.body.append(containerElement);
|
||||||
|
|
||||||
const observer = new ResizeObserver(repositionContainer);
|
const queueRepositionContainer = () => requestAnimationFrame(repositionContainer);
|
||||||
|
const observer = new ResizeObserver(queueRepositionContainer);
|
||||||
|
|
||||||
function handleMouseEnter(event) {
|
function handleMouseEnter(event) {
|
||||||
clearTogglePopoverTimeout();
|
clearTogglePopoverTimeout();
|
||||||
@ -100,7 +101,7 @@ function showPopover() {
|
|||||||
containerElement.style.display = "block";
|
containerElement.style.display = "block";
|
||||||
activeTarget.classList.add("popover-active");
|
activeTarget.classList.add("popover-active");
|
||||||
document.addEventListener("keydown", handleHidePopoverOnEscape);
|
document.addEventListener("keydown", handleHidePopoverOnEscape);
|
||||||
window.addEventListener("resize", repositionContainer);
|
window.addEventListener("resize", queueRepositionContainer);
|
||||||
observer.observe(containerElement);
|
observer.observe(containerElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ function hidePopover() {
|
|||||||
activeTarget.classList.remove("popover-active");
|
activeTarget.classList.remove("popover-active");
|
||||||
containerElement.style.display = "none";
|
containerElement.style.display = "none";
|
||||||
document.removeEventListener("keydown", handleHidePopoverOnEscape);
|
document.removeEventListener("keydown", handleHidePopoverOnEscape);
|
||||||
window.removeEventListener("resize", repositionContainer);
|
window.removeEventListener("resize", queueRepositionContainer);
|
||||||
observer.unobserve(containerElement);
|
observer.unobserve(containerElement);
|
||||||
|
|
||||||
if (cleanupOnHidePopover !== null) {
|
if (cleanupOnHidePopover !== null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user