Skip to content

feat(dashboard): let a touch screen choose its layout in Settings - #40180

Open
JLargent42 wants to merge 5 commits into
mainfrom
fix/40066-touch-layout-setting
Open

JLargent42 wants to merge 5 commits into
mainfrom
fix/40066-touch-layout-setting

Conversation

@JLargent42

@JLargent42 JLargent42 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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

What changed (motivation → approach → change)

The one place that decides the form on a touch-first device is touchFirstForm() (read by useIsMobile, the guide actions and the keyboard shortcuts), so the choice goes there instead of in each reader.

  • lib/touchLayoutForm.ts: a saved choice kc-touch-layout (auto | phone | desktop; anything else reads as auto). After the touch-first test, phone returns the phone form, desktop returns null (the 768px width rule, as a desktop-mode browser gets), auto keeps the browser-mode rule. Saving fires mc: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.
  • If the browser refuses the write, the choice is kept in memory so it still applies to the page.
  • docs/feature-map/README.md: the Display row names the new row.
  • Strings in all 12 catalogs with real translations, following each language's style guide. Settings registry, UI index and the narrow-viewport doc are regenerated or updated.

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

Machine: own computer, Linux x86_64 (Amazon Linux), 64 cores
Before (main c4078c90e5): `npx vitest run src/test/useIsMobile.touchForm.test.ts` with main's touchLayoutForm.ts and useIsMobile.ts -> 3 failed, 14 passed (Phone layout, Desktop layout, live change)
After (head 06d2ff1868): the same command -> 18 passed
Cleanup: own computer; the capture ran in a scratch Chromium that exited

Screenshots / video

Unfolded foldable, 951x690, touch-first. Before (main): phone layout, Interface is followed by Translucent panels, no way to change the layout.

before: main has no Touch screen layout row

After: the row sits under Interface and starts on Automatic (phone layout in a mobile-mode browser).

after: Automatic

After picking Desktop layout on wide screens: the desktop layout at once.

after: Desktop layout on wide screens

More states

Phone layout picked from a desktop-mode browser:

after: Phone layout

Light theme, Automatic:

after: light, Automatic

Related Issues

Fixes #40066

Checklist

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

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
@JLargent42
JLargent42 requested review from a team and KiroCrewCaptain as code owners November 20, 2026 22:12
@JLargent42 JLargent42 self-assigned this Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of d9041371c4834c995563857b09ec52e245cfc070 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the choice is read in touchFirstForm(), the one place that decides the layout on a touch-first device, defaults to today's rule, and is easy to revert.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d9041371c4834c995563857b09ec52e245cfc070 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 (touchFirstForm()). Two small extras are noted below.

Notes

  • Item 5 — inherited: let unsavedChoice: TouchLayoutChoice | null = null adds module-level state for "site storage blocked or full", but no linked issue or report names anyone hitting a refused write here. Subtraction: delete unsavedChoice and let readTouchLayoutChoice read only safeGetItem.
  • Item 1 — duplicate of website/src/hooks/useIsTouchDevice.ts: subscribeTouchFirst in TouchLayoutSetting.tsx is a line-for-line copy of that file's subscribe (same two queries, same add/remove). Grepping '(pointer: coarse)', '(hover: none)' lists finds 2 copies. Only the check differs: AND here, OR there. Subtraction: export subscribe from useIsTouchDevice.ts, delete subscribeTouchFirst and TOUCH_FIRST_QUERIES, and pair the shared subscribe with isTouchFirst.

What this change ships

Inventory (8 items) — 6 justified

Intent: let someone on a touch screen with no desktop-site toggle choose the phone or desktop layout. This is an ADDITION (Fixes #40066).

  1. New Touch screen layout row under Interface in Settings > Display > View, shown only on touch-first devices — justified
  2. Picking Phone layout gives the phone layout at any width — justified
  3. Picking Desktop layout gives the desktop layout from 768px up, regardless of browser mode — justified
  4. A change re-lays the page out at once, with no reload — justified
  5. A choice the browser refuses to save still applies to the current page — inherited (no reported case of a refused write)
  6. Settings search offers the row only on touch-first devices — justified
  7. Feature map, narrow-viewport doc, settings registry and UI index regenerated; strings added in all 12 catalogs — justified
  8. The Display-panel placement test's regex now lets the new row sit between the interface style and Translucent panels — undeclared; the pin's intent (View card, not the Theme card) still holds

[FIRST-PRINCIPLES-REVIEWED] d904137

Description read

[DESCRIPTION-READ] c4a5ca5b163bf6722bdc1bc6b05d0acaadf1915e2201a7f20a32034fed549ba7

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of d9041371c4834c995563857b09ec52e245cfc070 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • touch_layout_hint: the first words, "Use this if your browser has no Request desktop site option", don't say what the row does, and "768px" is a measurement a person can't check. Suggested text: "Choose the phone or desktop layout on this touch screen. Automatic follows the browser. Saved on this browser only."
  • The blind reader would not pick "Phone layout": "I'd have trouble finding this setting again." The hint could say that Settings stays reachable in either layout, or that the row is always here.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed d9041371c4834c995563857b09ec52e245cfc070 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d904137

Verdict parsed from the review's SHA-scoped output markers for commit d9041371c4834c995563857b09ec52e245cfc070.

False positive or not applicable? A repository writer can comment:
/ai-review override fable d9041371c4834c995563857b09ec52e245cfc070 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of d9041371c4834c995563857b09ec52e245cfc070 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d904137

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d9041371c4834c995563857b09ec52e245cfc070 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let a touch screen choose its layout when the browser has no desktop site toggle

1 participant