~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(settings): collapse sections by default on mobile (#4032)
LearningCircuitaced529e707b
diff --git a/.github/workflows/playwright-webkit-tests.yml b/.github/workflows/playwright-webkit-tests.ymlindex fde6274bba..2701773f98 100644--- a/.github/workflows/playwright-webkit-tests.yml+++ b/.github/workflows/playwright-webkit-tests.yml@@ -144,12 +144,14 @@ jobs:# - settings-subpages-mobile: settings tab navigation and form layouts# - mobile-ui-audit: comprehensive mobile UI quality checks# - embedding-settings-dropdown: regression for #3863 (model dropdown reset)+ # - settings-mobile-collapse: sections collapse by default on mobile (#4032),+ # stay expanded on desktop, and search force-expands survivors# Full suite: run locally via `cd tests/ui_tests/playwright && npm test`# When adding Safari-critical tests, update this filter pattern.run: |npx playwright test \--project="Desktop Safari" \- "all-pages-mobile|auth-pages-mobile|desktop-layout|interactive-states|settings-subpages-mobile|mobile-ui-audit|embedding-settings-dropdown"+ "all-pages-mobile|auth-pages-mobile|desktop-layout|interactive-states|settings-subpages-mobile|mobile-ui-audit|embedding-settings-dropdown|settings-mobile-collapse"- name: Upload Playwright Reportif: always()@@ -302,6 +304,8 @@ jobs:# - interactive-states: advanced options, search, help panels, mobile menus# - settings-subpages-mobile: settings tab navigation and form layouts# - mobile-ui-audit: comprehensive mobile UI quality checks+ # - settings-mobile-collapse: sections collapse by default on mobile (#4032);+ # this is the viewport where the >16384px overflow regression bites# Note: embedding-settings-dropdown is desktop-only (skips on isMobile),# so it intentionally only appears in the Desktop Safari filter above.# Full suite: run locally via `cd tests/ui_tests/playwright && npm test`@@ -309,7 +313,7 @@ jobs:run: |npx playwright test \--project="Mobile Safari" \- "all-pages-mobile|auth-pages-mobile|desktop-layout|interactive-states|settings-subpages-mobile|mobile-ui-audit"+ "all-pages-mobile|auth-pages-mobile|desktop-layout|interactive-states|settings-subpages-mobile|mobile-ui-audit|settings-mobile-collapse"- name: Upload Playwright Reportif: always()diff --git a/changelog.d/4032.bugfix.md b/changelog.d/4032.bugfix.mdnew file mode 100644index 0000000000..0bad12d55f--- /dev/null+++ b/changelog.d/4032.bugfix.md@@ -0,0 +1 @@+**Settings on mobile no longer scrolls forever.** Every section now starts collapsed at the mobile breakpoint (`max-width: 767px`) — page height drops from > 16,384 px to ~7,300 px on a Pixel 5. Desktop is unchanged; typing in the Settings search box still force-expands every surviving section.diff --git a/src/local_deep_research/web/static/css/settings-mobile-fix.css b/src/local_deep_research/web/static/css/settings-mobile-fix.cssindex 05e06738d1..2c8d08886c 100644--- a/src/local_deep_research/web/static/css/settings-mobile-fix.css+++ b/src/local_deep_research/web/static/css/settings-mobile-fix.css@@ -407,4 +407,34 @@display: flex;align-items: center;}++ /* Section accordion header — when the JS collapses sections by default on+ mobile (to keep the Settings page from rendering past 16384px tall),+ the header is the user's tap-to-drill-in surface. settings.css line+ 1419 stacks it as a column on mobile which buries the chevron under+ the title; override back to a row layout so the affordance is obvious.+ 44px enforces the touch-target floor. */+ .ldr-settings-section-header {+ flex-direction: row !important;+ align-items: center !important;+ justify-content: space-between !important;+ gap: 0.75rem !important;+ min-height: 44px;+ padding: 0.75rem 1rem;+ }++ .ldr-settings-toggle-icon {+ flex-shrink: 0;+ min-width: 32px;+ min-height: 32px;+ display: flex;+ align-items: center;+ justify-content: center;+ }++ /* Chevron rotation is handled by the base rule in settings.css+ (`.ldr-settings-section-header.collapsed .ldr-settings-toggle-icon`+ rotates the container -90deg). Do not add a second rotation here on+ the inner <i> — that would compound with the container's rotation+ and visually point the chevron at -180deg. */}diff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.jsindex 22dc868646..f99d7eaabf 100644--- a/src/local_deep_research/web/static/js/components/settings.js+++ b/src/local_deep_research/web/static/js/components/settings.js@@ -839,27 +839,71 @@}/**- * Initialize accordion behavior+ * Mobile breakpoint (px). Kept as a constant so JS callers and the+ * Playwright spec read from one place; CSS still hardcodes 767 in its+ * own `@media` rules because CSS can't read JS values. If you change+ * this, also update the `@media (max-width: 767px)` blocks in+ * settings.css and settings-mobile-fix.css.*/- function initAccordions() {+ const MOBILE_BREAKPOINT_PX = 767;+ if (typeof window !== 'undefined') {+ window.__LDR_MOBILE_BREAKPOINT_PX = MOBILE_BREAKPOINT_PX;+ }++ /**+ * Returns true when the viewport is in the mobile breakpoint that the rest+ * of the app uses (matches the `@media (max-width: 767px)` rules in CSS).+ */+ function isMobileSettingsViewport() {+ return typeof window !== 'undefined'+ && typeof window.matchMedia === 'function'+ && window.matchMedia('(max-width: ' + MOBILE_BREAKPOINT_PX + 'px)').matches;+ }++ /**+ * Initialize accordion behavior.+ *+ * Settings has ~400 controls split across many categories. On mobile that+ * is unusable — the page renders past 16384px tall and the user has to+ * scroll forever. So on mobile we start every section collapsed; the user+ * taps a section header to drill in. Desktop keeps the previous "all+ * expanded" default so power-user workflows don't change.+ *+ * Callers can override with `{ defaultCollapsed: false }` (e.g. the search+ * filter rebuild — when the user is actively searching, surviving matches+ * must be visible regardless of viewport).+ *+ * Chevron rotation is driven entirely by the `collapsed` class on the+ * header — see the `.ldr-settings-section-header.collapsed+ * .ldr-settings-toggle-icon` rule in settings.css. Do not toggle the+ * icon transform inline; CSS is the single source of truth for the+ * rotation, and setting transform on the inner <i> would compound+ * with the container's rotation.+ */+ function initAccordions(options) {+ const opts = options || {};+ const defaultCollapsed = typeof opts.defaultCollapsed === 'boolean'+ ? opts.defaultCollapsed+ : isMobileSettingsViewport();+document.querySelectorAll('.ldr-settings-section-header').forEach(header => {const targetId = header.dataset.target;const target = document.getElementById(targetId);if (target) {- // Set initial state - expanded- header.classList.remove('collapsed');- target.style.display = 'block';+ // Set initial state per viewport / caller override. The+ // `collapsed` class drives the chevron rotation via CSS.+ if (defaultCollapsed) {+ header.classList.add('collapsed');+ target.style.display = 'none';+ } else {+ header.classList.remove('collapsed');+ target.style.display = 'block';+ }header.addEventListener('click', () => {header.classList.toggle('collapsed');target.style.display = header.classList.contains('collapsed') ? 'none' : 'block';-- // Rotate chevron icon- const icon = header.querySelector('.ldr-settings-toggle-icon i');- if (icon) {- icon.style.transform = header.classList.contains('collapsed') ? 'rotate(-90deg)' : '';- }});}});@@ -2880,8 +2924,10 @@// eslint-disable-next-line no-unsanitized/property -- audited 2026-03-28: variable built from escaped/numeric values abovesettingsContent.innerHTML = html;- // Initialize accordion behavior - all expanded for search results- initAccordions();+ // Initialize accordion behavior - all expanded for search results.+ // Even on mobile, when the user is actively searching, every surviving+ // section must be visible so matches aren't hidden behind a tap.+ initAccordions({ defaultCollapsed: false });// Initialize JSON handlinginitJsonFormatting();diff --git a/tests/ui_tests/playwright/tests/settings-filter-behavior.spec.js b/tests/ui_tests/playwright/tests/settings-filter-behavior.spec.jsindex 707ec176b6..088864db29 100644--- a/tests/ui_tests/playwright/tests/settings-filter-behavior.spec.js+++ b/tests/ui_tests/playwright/tests/settings-filter-behavior.spec.js@@ -40,7 +40,11 @@ const NONSENSE_QUERY = 'zzz_no_such_setting_xyz';async function gotoSettings(page) {await page.goto('/settings/');- await page.waitForSelector(SETTING_ROW, { timeout: 15000 });+ // Use `state: 'attached'` because on mobile the section bodies are collapsed+ // by default — the rows are in the DOM but `display: none`, which makes the+ // default `state: 'visible'` wait time out. We're asserting on counts, not+ // pixel visibility, so DOM-attached is the right gate.+ await page.waitForSelector(SETTING_ROW, { state: 'attached', timeout: 15000 });// The settings page fetches its content asynchronously; allSettings is// populated after the initial render. Wait until at least the first burst// of rows is on the page before measuring the "before" count.diff --git a/tests/ui_tests/playwright/tests/settings-mobile-collapse.spec.js b/tests/ui_tests/playwright/tests/settings-mobile-collapse.spec.jsnew file mode 100644index 0000000000..199b823ba0--- /dev/null+++ b/tests/ui_tests/playwright/tests/settings-mobile-collapse.spec.js@@ -0,0 +1,160 @@+/**+ * Settings Mobile Collapse Behavior+ *+ * The Settings page renders ~400 controls across ~57 sections. Before this+ * change the page on mobile rendered taller than 16,384 px — Puppeteer's+ * screenshot ceiling and a real UX disaster for the user, who would scroll+ * for what felt like forever. `initAccordions()` now starts every section+ * collapsed at the `(max-width: 767px)` breakpoint; desktop keeps the old+ * "all expanded" default.+ *+ * Search filtering must override the collapse: when the user is actively+ * filtering, every surviving section needs to be visible.+ *+ * Three cases worth pinning down:+ *+ * 1. Mobile (small viewport): sections start collapsed; page height+ * drops well below the 16,384 px ceiling.+ * 2. Desktop: sections start expanded — same as the previous behavior,+ * so power-user workflows aren't disrupted.+ * 3. Mobile + active search: surviving sections are force-expanded so+ * matches aren't hidden behind a tap.+ *+ * This spec runs on a small mobile (Pixel 5) and a desktop project; the+ * Playwright project routing keeps each assertion paired with its viewport.+ */++import { test, expect } from '@playwright/test';++const SECTION_HEADER = '.ldr-settings-section-header';+const SECTION_BODY = '.ldr-settings-section-body';+const SEARCH_INPUT = '#settings-search';++async function gotoSettings(page) {+ await page.goto('/settings/');+ await page.waitForSelector(SECTION_HEADER, { state: 'attached', timeout: 15000 });+ // initAccordions runs synchronously after innerHTML, but the async settings+ // fetch -> render -> initAccordions chain takes a moment. Poll for the+ // section count to stabilise before reading the collapsed state.+ await expect.poll(+ async () => page.locator(SECTION_HEADER).count(),+ { timeout: 10000, message: 'settings sections should finish rendering' },+ ).toBeGreaterThan(5);+}++async function isMobileViewport(page) {+ // Read the breakpoint from the same constant settings.js uses, so a+ // future change to the threshold doesn't desync the test from production.+ const breakpoint = await page.evaluate(+ () => window.__LDR_MOBILE_BREAKPOINT_PX ?? 767,+ );+ return page.evaluate(+ (bp) => window.matchMedia(`(max-width: ${bp}px)`).matches,+ breakpoint,+ );+}++test.describe('Settings Mobile Collapse', () => {+ test('sections start collapsed on mobile, expanded on desktop', async ({ page }) => {+ await gotoSettings(page);++ const mobile = await isMobileViewport(page);+ const stats = await page.evaluate(([headerSel, bodySel]) => {+ const headers = Array.from(document.querySelectorAll(headerSel));+ const bodies = Array.from(document.querySelectorAll(bodySel));+ return {+ total: headers.length,+ collapsed: headers.filter((h) => h.classList.contains('collapsed')).length,+ visibleBodies: bodies.filter((b) => getComputedStyle(b).display !== 'none').length,+ };+ }, [SECTION_HEADER, SECTION_BODY]);++ expect(stats.total, 'should render multiple sections').toBeGreaterThan(5);++ if (mobile) {+ expect(stats.collapsed, 'every section should start collapsed on mobile').toBe(stats.total);+ expect(stats.visibleBodies, 'no section body visible on mobile').toBe(0);+ } else {+ expect(stats.collapsed, 'no section should start collapsed on desktop').toBe(0);+ expect(stats.visibleBodies, 'every section body visible on desktop').toBe(stats.total);+ }+ });++ test('mobile page height drops below the 16384px screenshot ceiling', async ({ page }) => {+ await gotoSettings(page);+ const mobile = await isMobileViewport(page);+ test.skip(!mobile, 'page-height assertion is only meaningful at the mobile breakpoint');++ const pageHeight = await page.evaluate(() => document.documentElement.scrollHeight);++ // The bug we're fixing rendered the page > 16,384px tall. Pick a+ // comfortable bound below that (10,000px) — a regression that+ // re-expands sections by default would blow past 16,384 again.+ expect(pageHeight, 'collapsed Settings should be well under 16384px tall').toBeLessThan(10000);+ });++ test('active search forces surviving sections to expand', async ({ page }) => {+ await gotoSettings(page);++ await page.evaluate((selector) => {+ const input = document.querySelector(selector);+ input.focus();+ input.value = 'iterations';+ input.dispatchEvent(new Event('input', { bubbles: true }));+ }, SEARCH_INPUT);++ // The search rebuild is synchronous; the DOM swap is fast but the+ // initAccordions call is right after innerHTML assignment, so poll+ // until the collapsed count reaches zero rather than racing it.+ await expect.poll(+ async () => page.evaluate((headerSel) => {+ const headers = Array.from(document.querySelectorAll(headerSel));+ return {+ total: headers.length,+ collapsed: headers.filter((h) => h.classList.contains('collapsed')).length,+ };+ }, SECTION_HEADER),+ { timeout: 3000, message: 'every surviving section should be expanded during search' },+ ).toEqual(expect.objectContaining({ collapsed: 0 }));++ const post = await page.evaluate((headerSel) => {+ const headers = Array.from(document.querySelectorAll(headerSel));+ return { total: headers.length };+ }, SECTION_HEADER);+ expect(post.total, 'search should still return matching sections').toBeGreaterThan(0);+ });++ test('tapping a collapsed header expands it; tapping again collapses', async ({ page }) => {+ await gotoSettings(page);+ const mobile = await isMobileViewport(page);+ test.skip(!mobile, 'desktop sections start expanded; the toggle starting state differs there');++ // First tap: expand+ await page.locator(SECTION_HEADER).first().click();+ await expect.poll(+ async () => page.evaluate((sel) => {+ const h = document.querySelector(sel);+ const body = document.getElementById(h.getAttribute('data-target'));+ return {+ collapsed: h.classList.contains('collapsed'),+ bodyDisplay: body ? getComputedStyle(body).display : null,+ };+ }, SECTION_HEADER),+ { timeout: 2000, message: 'first tap should expand the section' },+ ).toEqual({ collapsed: false, bodyDisplay: 'block' });++ // Second tap: collapse again+ await page.locator(SECTION_HEADER).first().click();+ await expect.poll(+ async () => page.evaluate((sel) => {+ const h = document.querySelector(sel);+ const body = document.getElementById(h.getAttribute('data-target'));+ return {+ collapsed: h.classList.contains('collapsed'),+ bodyDisplay: body ? getComputedStyle(body).display : null,+ };+ }, SECTION_HEADER),+ { timeout: 2000, message: 'second tap should collapse the section again' },+ ).toEqual({ collapsed: true, bodyDisplay: 'none' });+ });+});