From 01792e8a58e2e0588df27a0deb1ded4865e808ed Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Jan 2026 10:49:57 +0000 Subject: [PATCH] fix: Correct group toggle functionality Fix the toggleGroup() function to properly collapse/expand grouped downloads: - Use classList.contains('collapsed') to check state instead of checking style.display - Properly add/remove 'collapsed' class on toggle - Groups now correctly collapse when clicked and expand when clicked again - Arrow rotates correctly with CSS transition The previous implementation checked items.style.display which was initially empty, causing the toggle to not work correctly. Now we use the CSS class as the source of truth. --- templates/index.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/templates/index.html b/templates/index.html index ba9a3ac..1af6a1d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1646,8 +1646,17 @@ function toggleGroup(header) { const items = header.nextElementSibling; - items.style.display = items.style.display === 'none' ? 'flex' : 'none'; - header.classList.toggle('collapsed'); + const isCollapsed = header.classList.contains('collapsed'); + + if (isCollapsed) { + // Expand + items.style.display = 'flex'; + header.classList.remove('collapsed'); + } else { + // Collapse + items.style.display = 'none'; + header.classList.add('collapsed'); + } } async function pauseDownload(id) {