Repository navigation
feat(dashboard): let a touch screen choose its layout in Settings - #40180
JLargent42 wants to merge 5 commits into
Conversation
A touch-first device took its layout only from the browser's mobile or desktop site mode, so a browser with no Request desktop site toggle (an installed web app, an in-app browser) left no way to change it. Settings > Display > View gets a Touch screen layout row with Automatic (today's behaviour), Phone layout and Desktop layout on wide screens. It shows only on a touch-first device, is saved on this browser only, and applies at once: touchFirstForm reads the choice and useIsMobile re-reads the form on its change event. Fixes #40066
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the choice is read in [DESIGN-REVIEWED] d904137 Description read[DESCRIPTION-READ] 39193355317045ae1febde1b54cd1cdc3f75cf49d38b8eab2b83de63c951de53 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Automatic stays the default and matches today's rule, and the new choice is read in the one place that already decides the touch-first layout ( Notes
What this change shipsInventory (8 items) — 6 justifiedIntent: let someone on a touch screen with no desktop-site toggle choose the phone or desktop layout. This is an ADDITION (Fixes #40066).
[FIRST-PRINCIPLES-REVIEWED] d904137 Description read[DESCRIPTION-READ] c4a5ca5b163bf6722bdc1bc6b05d0acaadf1915e2201a7f20a32034fed549ba7 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The blind reader read the new "Touch screen layout" row and all three of its options correctly, and the screenshots cover every option and the desktop layout the app switches to. Notes
[UX-REVIEWED] d904137 Description read[DESCRIPTION-READ] 29a537349968ef89805751aaf19a50730e4e0ee003aa610df5158544e5c2c2b4 That sha256 names everything this verdict read: the PR description, plus the 8 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Problem / Motivation
Goal: A person on a touch screen can choose the phone or the desktop layout from Settings when their browser has no desktop-site toggle.
A touch-first device (coarse pointer, no hover) takes its layout only from the browser's mobile or desktop site mode: mobile mode gets the phone layout at any width, desktop mode gets the desktop layout from 768px up. An installed web app or an in-app browser has no "Request desktop site" toggle, so on a foldable unfolded to 951px wide the layout is fixed by a browser default the person cannot change.
touchFirstForm()already notes this gap for home-screen web apps.Why it matters
Anyone on a tablet or foldable in an installed web app or in-app browser is stuck with one layout past 768px, with no way to get the phone layout's touch drawers or the desktop layout's sessions sidebar.
Not a goal
touchFirstForm(); this PR only adds the person's explicit choice in front of the browser-mode rule.What changed (motivation → approach → change)
The one place that decides the form on a touch-first device is
touchFirstForm()(read byuseIsMobile, the guide actions and the keyboard shortcuts), so the choice goes there instead of in each reader.lib/touchLayoutForm.ts: a saved choicekc-touch-layout(auto|phone|desktop; anything else reads asauto). After the touch-first test,phonereturns the phone form,desktopreturnsnull(the 768px width rule, as a desktop-mode browser gets),autokeeps the browser-mode rule. Saving firesmc:touch-layout-changed.hooks/useIsMobile.ts: that event joins the window events that re-read the form, so a change applies at once with no reload.pages/settings/TouchLayoutSetting.tsx: the Settings > Display > View row, Touch screen layout, under Interface. Drawn only on a touch-first device. Search offers it only there too (settingEntryOffered), like Reopen where I left off.docs/feature-map/README.md: the Display row names the new row.Alternatives: a toggle in the browser (not available in installed apps), fold detection (the right form depends on the person and the session), syncing with the other UI settings (a phone and a tablet on one account want different answers).
Backwards compatibility
Compatible: the default is Automatic, which is today's rule; a missing or unknown stored value reads as Automatic, and a device with a mouse never reads it.
Removes nothing: no key, route or behaviour is removed or renamed.
Tests
useIsMobile.touchForm.test.ts: Phone layout gives the phone form at 951px in a desktop-mode browser; Desktop layout gives the desktop form at 951px in a mobile-mode browser and keeps the phone form below 768px; Automatic, a missing value and an unknown value follow the browser; a device with a mouse ignores the choice; a change re-lays-out at once; a choice the browser refuses to save (site storage blocked) still applies to the page.touchLayoutSetting.test.tsx: the row is hidden with a mouse, starts on Automatic, and each pick is saved and changes the form.settingsSearchGovernance.test.ts: search offers the row only on a touch-first device.Manual verification
Full app in Chromium at 951x690 with a coarse pointer and no hover, network stubbed, no gateway and no token. Main shows the phone layout and no row. The head shows the row, and picking Desktop layout on wide screens switches to the desktop layout without a reload; the choice survives a reload. A desktop-mode browser picking Phone layout switches the other way.
Real-machine verification
Screenshots / video
Unfolded foldable, 951x690, touch-first. Before (main): phone layout, Interface is followed by Translucent panels, no way to change the layout.
After: the row sits under Interface and starts on Automatic (phone layout in a mobile-mode browser).
After picking Desktop layout on wide screens: the desktop layout at once.
More states
Phone layout picked from a desktop-mode browser:
Light theme, Automatic:
Related Issues
Fixes #40066
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.