aeab81dd42
PROBLEM: - htmx:swapError with "Cannot read properties of null (reading 'insertBefore')" on double-click - Toggle animations were "digital" (instant snap) instead of "analogical" (smooth slide) - Conflict between server templates with hx-swap-oob and client-side hyperscript ROOT CAUSE: - Server templates returned HTML with hx-swap="outerHTML" + hx-swap-oob="true" - This destroyed and recreated DOM elements during swap - Second click tried to insert into null parent (element was destroyed) - CSS transitions broke because element was destroyed mid-animation SOLUTION: - Remove all HTML from toggle templates (length-toggle.html, logo-toggle.html, theme-toggle.html) - Templates now return empty comment: "<!-- Template not used - toggles use hx-swap="none" with inline hyperscript -->" - Toggles use hx-swap="none" to prevent any DOM replacement - All visual updates handled client-side via inline hyperscript - Server only saves cookies in background (no HTML returned) BENEFITS: - ✅ No more null reference errors (no DOM destruction) - ✅ Smooth CSS transitions work perfectly (element preserved) - ✅ Desktop/mobile toggles sync via direct ID manipulation - ✅ Zero HTMX swap conflicts - ✅ Clean separation: client handles visuals, server persists state DOCUMENTATION: - Updated MODERN-WEB-TECHNIQUES.md with Phase 8 - Documented the complete debug journey and solution - Added architecture pattern for client-first toggles
2 lines
80 B
HTML
2 lines
80 B
HTML
<!-- Template not used - toggles use hx-swap="none" with inline hyperscript -->
|