82f73cf724
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)
85 lines
3.2 KiB
JavaScript
Executable File
85 lines
3.2 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { chromium } from 'playwright';
|
|
|
|
const LANDSCAPE_VIEWPORT = { width: 667, height: 375 };
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const context = await browser.newContext({
|
|
viewport: LANDSCAPE_VIEWPORT,
|
|
userAgent: 'Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36',
|
|
hasTouch: true
|
|
});
|
|
const page = await context.newPage();
|
|
|
|
await page.goto('http://localhost:1999/?lang=en&view=extended');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Take a screenshot to see what's visible
|
|
await page.screenshot({
|
|
path: 'tests/screenshots/sidebar-debug-landscape.png',
|
|
fullPage: true
|
|
});
|
|
|
|
const details = await page.evaluate(() => {
|
|
const sidebar = document.querySelector('.cv-sidebar-left');
|
|
const accordion = document.querySelector('.sidebar-accordion');
|
|
|
|
// Get all children of sidebar
|
|
const sidebarChildren = Array.from(sidebar.children).map(child => ({
|
|
tag: child.tagName,
|
|
class: child.className,
|
|
height: Math.round(child.getBoundingClientRect().height),
|
|
display: window.getComputedStyle(child).display,
|
|
position: window.getComputedStyle(child).position
|
|
}));
|
|
|
|
// Get all children of accordion
|
|
const accordionChildren = Array.from(accordion.children).map(child => ({
|
|
tag: child.tagName,
|
|
class: child.className,
|
|
height: Math.round(child.getBoundingClientRect().height),
|
|
display: window.getComputedStyle(child).display
|
|
}));
|
|
|
|
// Check if there's a min-height or explicit height
|
|
const sidebarStyles = window.getComputedStyle(sidebar);
|
|
|
|
return {
|
|
sidebarChildren,
|
|
accordionChildren,
|
|
sidebarStyles: {
|
|
height: sidebarStyles.height,
|
|
minHeight: sidebarStyles.minHeight,
|
|
maxHeight: sidebarStyles.maxHeight,
|
|
boxSizing: sidebarStyles.boxSizing,
|
|
padding: sidebarStyles.padding,
|
|
}
|
|
};
|
|
});
|
|
|
|
console.log('Sidebar Children:');
|
|
details.sidebarChildren.forEach((child, i) => {
|
|
console.log(` ${i + 1}. <${child.tag}> .${child.class}`);
|
|
console.log(` Height: ${child.height}px, Display: ${child.display}, Position: ${child.position}`);
|
|
});
|
|
|
|
console.log('\nAccordion Children:');
|
|
details.accordionChildren.forEach((child, i) => {
|
|
console.log(` ${i + 1}. <${child.tag}> .${child.class}`);
|
|
console.log(` Height: ${child.height}px, Display: ${child.display}`);
|
|
});
|
|
|
|
console.log('\nSidebar Computed Styles:');
|
|
console.log(` • height: ${details.sidebarStyles.height}`);
|
|
console.log(` • min-height: ${details.sidebarStyles.minHeight}`);
|
|
console.log(` • max-height: ${details.sidebarStyles.maxHeight}`);
|
|
console.log(` • box-sizing: ${details.sidebarStyles.boxSizing}`);
|
|
console.log(` • padding: ${details.sidebarStyles.padding}`);
|
|
|
|
console.log('\nScreenshot saved to: tests/screenshots/sidebar-debug-landscape.png');
|
|
|
|
await browser.close();
|
|
})();
|