Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(css): prevent sidebar overlap on desktop and add layout tests

LearningCircuit4a0abb26f4d5
diff --git a/src/local_deep_research/web/static/css/styles.css b/src/local_deep_research/web/static/css/styles.css
index 165cb775fc..f1628675bc 100644
--- a/src/local_deep_research/web/static/css/styles.css
+++ b/src/local_deep_research/web/static/css/styles.css
@@ -2643,10 +2643,11 @@ input[type="number"].ldr-form-control::-webkit-inner-spin-button {
/* Large desktop (1200px+) */
@media (min-width: 1200px) {
.ldr-main-content {
- max-width: 1400px;
- margin: 0 auto;
+ /* Keep margin-left for sidebar, use max-width for content centering */
+ max-width: calc(1400px + 240px);
padding: var(--space-6, 2rem);
padding-top: calc(60px + var(--space-6, 2rem)); /* Account for fixed header */
+ /* Note: margin-left: 240px is inherited from base styles for sidebar offset */
}
/* Two-column layout for metrics on desktop */
@@ -2671,7 +2672,7 @@ input[type="number"].ldr-form-control::-webkit-inner-spin-button {
/* Extra large desktop (1600px+) */
@media (min-width: 1600px) {
.ldr-main-content {
- max-width: 1600px;
+ max-width: calc(1600px + 240px);
}
/* Three-column layout for metrics on extra large screens */
@@ -2688,7 +2689,7 @@ input[type="number"].ldr-form-control::-webkit-inner-spin-button {
/* Ultra-wide screens (1920px+) */
@media (min-width: 1920px) {
.ldr-main-content {
- max-width: 1800px;
+ max-width: calc(1800px + 240px);
}
/* Even larger padding for comfortable reading */
diff --git a/tests/ui_tests/playwright/tests/desktop-layout.spec.js b/tests/ui_tests/playwright/tests/desktop-layout.spec.js
new file mode 100644
index 0000000000..0b0279d7a6
--- /dev/null
+++ b/tests/ui_tests/playwright/tests/desktop-layout.spec.js
@@ -0,0 +1,317 @@
+/**
+ * Desktop Layout Tests
+ *
+ * Tests to verify the desktop sidebar layout works correctly
+ * and doesn't overlap with the main content at various viewport sizes.
+ *
+ * Breakpoints tested:
+ * - 768px-991px: Collapsed sidebar (60px)
+ * - 992px-1199px: Full sidebar (240px)
+ * - 1200px+: Large desktop with max-width constraints
+ * - 1600px+: Extra large desktop
+ * - 1920px+: Ultra-wide screens
+ */
+
+import { test, expect } from '@playwright/test';
+
+// Only run on desktop browsers
+test.describe('Desktop Sidebar Layout', () => {
+ test.beforeEach(async ({ page, isMobile }) => {
+ // Skip all tests in this file for mobile devices
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+ });
+
+ test('Sidebar does not overlap main content at 1200px width', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1200, height: 800 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ // Get sidebar and main content bounding boxes
+ const sidebar = page.locator('.ldr-sidebar');
+ const mainContent = page.locator('.ldr-main-content');
+
+ const sidebarBox = await sidebar.boundingBox();
+ const mainContentBox = await mainContent.boundingBox();
+
+ expect(sidebarBox).not.toBeNull();
+ expect(mainContentBox).not.toBeNull();
+
+ if (sidebarBox && mainContentBox) {
+ // Main content should start after sidebar ends (no overlap)
+ const sidebarRightEdge = sidebarBox.x + sidebarBox.width;
+ expect(mainContentBox.x).toBeGreaterThanOrEqual(sidebarRightEdge - 1); // Allow 1px tolerance
+ }
+ });
+
+ test('Sidebar does not overlap main content at 1400px width', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1400, height: 900 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ const sidebar = page.locator('.ldr-sidebar');
+ const mainContent = page.locator('.ldr-main-content');
+
+ const sidebarBox = await sidebar.boundingBox();
+ const mainContentBox = await mainContent.boundingBox();
+
+ expect(sidebarBox).not.toBeNull();
+ expect(mainContentBox).not.toBeNull();
+
+ if (sidebarBox && mainContentBox) {
+ const sidebarRightEdge = sidebarBox.x + sidebarBox.width;
+ expect(mainContentBox.x).toBeGreaterThanOrEqual(sidebarRightEdge - 1);
+ }
+ });
+
+ test('Sidebar does not overlap main content at 1600px width', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1600, height: 900 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ const sidebar = page.locator('.ldr-sidebar');
+ const mainContent = page.locator('.ldr-main-content');
+
+ const sidebarBox = await sidebar.boundingBox();
+ const mainContentBox = await mainContent.boundingBox();
+
+ expect(sidebarBox).not.toBeNull();
+ expect(mainContentBox).not.toBeNull();
+
+ if (sidebarBox && mainContentBox) {
+ const sidebarRightEdge = sidebarBox.x + sidebarBox.width;
+ expect(mainContentBox.x).toBeGreaterThanOrEqual(sidebarRightEdge - 1);
+ }
+ });
+
+ test('Sidebar does not overlap main content at 1920px width', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1920, height: 1080 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ const sidebar = page.locator('.ldr-sidebar');
+ const mainContent = page.locator('.ldr-main-content');
+
+ const sidebarBox = await sidebar.boundingBox();
+ const mainContentBox = await mainContent.boundingBox();
+
+ expect(sidebarBox).not.toBeNull();
+ expect(mainContentBox).not.toBeNull();
+
+ if (sidebarBox && mainContentBox) {
+ const sidebarRightEdge = sidebarBox.x + sidebarBox.width;
+ expect(mainContentBox.x).toBeGreaterThanOrEqual(sidebarRightEdge - 1);
+ }
+ });
+
+ test('Collapsed sidebar (60px) at 900px width', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 900, height: 700 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ const sidebar = page.locator('.ldr-sidebar');
+ const mainContent = page.locator('.ldr-main-content');
+
+ const sidebarBox = await sidebar.boundingBox();
+ const mainContentBox = await mainContent.boundingBox();
+
+ expect(sidebarBox).not.toBeNull();
+ expect(mainContentBox).not.toBeNull();
+
+ if (sidebarBox && mainContentBox) {
+ // At 900px, sidebar should be collapsed to 60px
+ expect(sidebarBox.width).toBeLessThanOrEqual(65); // Allow small tolerance
+
+ // Main content should start after sidebar
+ const sidebarRightEdge = sidebarBox.x + sidebarBox.width;
+ expect(mainContentBox.x).toBeGreaterThanOrEqual(sidebarRightEdge - 1);
+ }
+ });
+
+ test('Full sidebar (240px) at 1000px width', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1000, height: 700 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ const sidebar = page.locator('.ldr-sidebar');
+ const mainContent = page.locator('.ldr-main-content');
+
+ const sidebarBox = await sidebar.boundingBox();
+ const mainContentBox = await mainContent.boundingBox();
+
+ expect(sidebarBox).not.toBeNull();
+ expect(mainContentBox).not.toBeNull();
+
+ if (sidebarBox && mainContentBox) {
+ // At 1000px (above 991px breakpoint), sidebar should be full 240px
+ expect(sidebarBox.width).toBeGreaterThanOrEqual(235); // Allow small tolerance
+ expect(sidebarBox.width).toBeLessThanOrEqual(245);
+
+ // Main content should start after sidebar
+ const sidebarRightEdge = sidebarBox.x + sidebarBox.width;
+ expect(mainContentBox.x).toBeGreaterThanOrEqual(sidebarRightEdge - 1);
+ }
+ });
+});
+
+// Visual regression tests for desktop layouts
+test.describe('Desktop Layout Screenshots', () => {
+ test('Settings page at 1200px - sidebar visible', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1200, height: 800 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ await expect(page).toHaveScreenshot('desktop-settings-1200px.png', {
+ maxDiffPixelRatio: 0.02,
+ });
+ });
+
+ test('Settings page at 1600px - large desktop', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1600, height: 900 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ await expect(page).toHaveScreenshot('desktop-settings-1600px.png', {
+ maxDiffPixelRatio: 0.02,
+ });
+ });
+
+ test('Settings page at 900px - collapsed sidebar', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 900, height: 700 });
+ await page.goto('/settings/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ await expect(page).toHaveScreenshot('desktop-settings-900px-collapsed.png', {
+ maxDiffPixelRatio: 0.02,
+ });
+ });
+
+ test('Research page at 1200px', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1200, height: 800 });
+ await page.goto('/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ await expect(page).toHaveScreenshot('desktop-research-1200px.png', {
+ maxDiffPixelRatio: 0.02,
+ });
+ });
+
+ test('Metrics page at 1200px', async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1200, height: 800 });
+ await page.goto('/metrics/');
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ await expect(page).toHaveScreenshot('desktop-metrics-1200px.png', {
+ maxDiffPixelRatio: 0.02,
+ });
+ });
+});
+
+// Test all main pages don't have sidebar overlap
+test.describe('All Pages - Sidebar No Overlap', () => {
+ const pages = [
+ { path: '/', name: 'Research' },
+ { path: '/history/', name: 'History' },
+ { path: '/settings/', name: 'Settings' },
+ { path: '/news/', name: 'News' },
+ { path: '/library/', name: 'Library' },
+ { path: '/metrics/', name: 'Metrics' },
+ ];
+
+ for (const { path, name } of pages) {
+ test(`${name} page - no sidebar overlap at 1200px`, async ({ page, isMobile }) => {
+ if (isMobile) {
+ test.skip();
+ return;
+ }
+
+ await page.setViewportSize({ width: 1200, height: 800 });
+ await page.goto(path);
+ await page.waitForLoadState('domcontentloaded');
+ await page.waitForTimeout(500);
+
+ const sidebar = page.locator('.ldr-sidebar');
+ const mainContent = page.locator('.ldr-main-content');
+
+ const sidebarBox = await sidebar.boundingBox();
+ const mainContentBox = await mainContent.boundingBox();
+
+ // Sidebar should be visible on desktop
+ expect(sidebarBox).not.toBeNull();
+ expect(mainContentBox).not.toBeNull();
+
+ if (sidebarBox && mainContentBox) {
+ const sidebarRightEdge = sidebarBox.x + sidebarBox.width;
+ expect(mainContentBox.x).toBeGreaterThanOrEqual(sidebarRightEdge - 1);
+ }
+ });
+ }
+});