fix: CRITICAL - Restore sidebar visibility in landscape mode

Fixed critical issue where sidebars were completely collapsed/hidden
in landscape mode, showing only 33px accordion headers instead of full content.

ROOT CAUSE:
- Sidebar accordions (<details> elements) were collapsed by default
- Native <details> browser behavior prevented CSS-only expansion
- Sidebar content was present but hidden behind collapsed accordion

SOLUTION:
1. JavaScript: Added handleLandscapeAccordions() to auto-open sidebar
   accordions when in landscape orientation (≤915px width)
   - Runs on DOMContentLoaded, orientationchange, and resize events
   - Uses matchMedia to detect landscape mode
   - Sets 'open' attribute on all .sidebar-accordion elements

2. CSS: Enhanced sidebar container styles in landscape mode
   - Set overflow: visible on sidebars (was hidden)
   - Set height: auto on sidebars and .actual-content wrappers
   - Forced accordion content visibility with !important rules
   - Made summary non-clickable in landscape (pointer-events: none)

3. Tests: Updated landscape test to validate sidebar visibility
   - Now checks sidebar visible/hidden state
   - Validates sidebar height (should be >100px, not 33px)
   - Added debug tests for troubleshooting

RESULTS:
- Sidebar height: 1387px (Android) / 1536px (iPhone) ✓
- Accordion state: OPEN ✓
- All sidebar content fully visible ✓
- No horizontal scroll ✓

Test files:
- tests/mjs/54-landscape-mode-test.mjs (updated with sidebar checks)
- tests/mjs/60-sidebar-content-debug.mjs (new debug test)
- tests/mjs/61-sidebar-positioning-debug.mjs (positioning debug)
- tests/mjs/62-sidebar-computed-height-debug.mjs (height debug)
- tests/mjs/63-media-query-match-test.mjs (media query validation)
This commit is contained in:
juanatsap
2025-11-25 05:44:40 +00:00
parent 945928d930
commit 82f73cf724
7 changed files with 464 additions and 6 deletions
+31
View File
@@ -73,6 +73,36 @@
document.querySelectorAll('details').forEach(d => d.removeAttribute('open'));
};
/**
* Auto-open sidebar accordions in landscape mobile mode
* Ensures sidebar content is visible in landscape orientation
*/
function handleLandscapeAccordions() {
function openSidebarAccordionsIfLandscape() {
const isLandscape = window.matchMedia('(max-width: 915px) and (orientation: landscape)').matches;
if (isLandscape) {
// Open all sidebar accordions in landscape mode
document.querySelectorAll('.sidebar-accordion').forEach(accordion => {
accordion.setAttribute('open', '');
});
}
}
// Run on load
openSidebarAccordionsIfLandscape();
// Run on orientation change
window.addEventListener('orientationchange', () => {
setTimeout(openSidebarAccordionsIfLandscape, 100);
});
// Run on resize (for desktop browser testing)
window.addEventListener('resize', () => {
openSidebarAccordionsIfLandscape();
});
}
/**
* Close menu when navigation links are clicked
* CSS handles scrolling with scroll-behavior: smooth
@@ -539,6 +569,7 @@
initPreferences();
initErrorToastClose();
initHTMXHandlers();
handleLandscapeAccordions(); // Auto-open sidebar accordions in landscape mode
initZoomControlButtons();
});