From 36d4a02a459b4f91e7bd073866743fb96d046941 Mon Sep 17 00:00:00 2001 From: Sli Date: Tue, 10 Jun 2025 15:06:59 +0200 Subject: [PATCH] Remove js size animation and only use the opacity one --- core/static/bundled/core/accordion-index.ts | 33 --------------------- core/templates/core/base.jinja | 1 - 2 files changed, 34 deletions(-) delete mode 100644 core/static/bundled/core/accordion-index.ts diff --git a/core/static/bundled/core/accordion-index.ts b/core/static/bundled/core/accordion-index.ts deleted file mode 100644 index d2007767..00000000 --- a/core/static/bundled/core/accordion-index.ts +++ /dev/null @@ -1,33 +0,0 @@ -const updateMaxHeight = (element: HTMLDetailsElement) => { - const content = element.querySelector(".accordion-content") as HTMLElement | null; - if (!content) { - return; - } - if (element.hasAttribute("open")) { - content.style.maxHeight = `${content.scrollHeight}px`; - } else { - content.style.maxHeight = "0px"; - } -}; - -// Initialize max-height at load -window.addEventListener("DOMContentLoaded", () => { - for (const el of document.querySelectorAll("details.accordion")) { - updateMaxHeight(el as HTMLDetailsElement); - } -}); - -// Accordion opened -new MutationObserver((mutations: MutationRecord[]) => { - for (const mutation of mutations) { - const target = mutation.target as HTMLDetailsElement; - if (target.tagName !== "DETAILS" || !target.classList.contains("accordion")) { - continue; - } - updateMaxHeight(target); - } -}).observe(document.body, { - attributes: true, - attributeFilter: ["open"], - subtree: true, -}); diff --git a/core/templates/core/base.jinja b/core/templates/core/base.jinja index 0d476689..a3afb49f 100644 --- a/core/templates/core/base.jinja +++ b/core/templates/core/base.jinja @@ -27,7 +27,6 @@ -