diff --git a/static/js/cookbook.js b/static/js/cookbook.js index ee71300f2..df065930c 100644 --- a/static/js/cookbook.js +++ b/static/js/cookbook.js @@ -1404,7 +1404,9 @@ function _wireTabEvents(body) { const dlFoldChevron = document.getElementById('cookbook-dl-tab-chevron'); if (dlFold && dlFoldBody && dlFoldChevron) { const _setFolded = (folded, persist = true) => { - dlFoldBody.style.display = folded ? 'none' : ''; + // Toggle via class so CSS transition animates the height/opacity + // — display:none was an instant on/off and felt jarring. + dlFoldBody.classList.toggle('is-folded', folded); dlFoldChevron.textContent = folded ? '▸' : '▾'; dlFold.classList.toggle('is-folded', folded); if (persist) { @@ -1412,7 +1414,7 @@ function _wireTabEvents(body) { } }; dlFold.addEventListener('click', () => { - const folded = dlFoldBody.style.display === 'none'; + const folded = dlFoldBody.classList.contains('is-folded'); _setFolded(!folded); }); // Auto-fold on any downward scroll inside the cookbook modal, @@ -1420,11 +1422,11 @@ function _wireTabEvents(body) { // top of whichever scroller they're in. The chevron ▸ still // toggles manually. const _maybeFold = () => { - if (dlFoldBody.style.display === 'none') return; + if (dlFoldBody.classList.contains('is-folded')) return; _setFolded(true, /* persist */ false); }; const _maybeExpand = () => { - if (dlFoldBody.style.display !== 'none') return; + if (!dlFoldBody.classList.contains('is-folded')) return; _setFolded(false, /* persist */ false); }; // Capture phase so scrolls on nested scrollers (.hwfit-list, @@ -1816,7 +1818,7 @@ function _renderRecipes() { html += '