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) {