From fd35f79c361272041af23e06ce174f59d77eba58 Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 18 Nov 2026 21:23:14 +0100 Subject: [PATCH] fix(mobile): keep every screen clear of an iPhone Duo's status capsule TestFlight feedback: on an iPhone Duo the status capsule in the top right corner covered the trip's controls, its day chips, the map's category bar and the first cards of every trip tab, upright and on its side. The app has measured the capsule since 0f42b8b8a, but only the shell's own bars and page used it, and the trip, its map and the sheets place their own controls. - Upright, a control row in the capsule's height stands beside it and the content starts below it: the trip's top row and day chips, the map's category bar, the road trip's stage bar, every trip tab's first row, the places browser, the plan timeline, docked and card sheets, the assistant, the account menu, the image viewer's close button, the atlas search, vacay's header and a journey's content and map controls. - On a wide window the page gives up the capsule's side over the whole height instead, as an iPhone on its side does for its camera: lifting each page below the capsule cost a quarter of the height of an unfolded Duo. The list tabs, the assistant panel and the form sheets end before it too. - Screens whose first row is part of the page (settings, administration, collections) are lifted until that row is below the capsule; screens that keep clear of it by themselves (atlas, vacay, a journey) are not lifted. - Right to left the rail stands on the capsule's side and takes it. All of it reads the corner variables the app publishes, which are 0 on every other device and before iOS 26, so nothing else moves. The rules for the screens that place their own controls live in mobile/corner.css. --- client/src/mobile/MobileShell.tsx | 1 + client/src/mobile/components/MImageViewer.tsx | 2 +- client/src/mobile/components/MSectionNav.tsx | 2 +- client/src/mobile/components/MSheet.tsx | 7 +-- client/src/mobile/corner.css | 31 +++++++++++ client/src/mobile/mobile.css | 51 +++++++++++++++++-- client/src/mobile/screens/atlas/MAtlas.tsx | 2 +- .../src/mobile/screens/atlas/MAtlasSearch.tsx | 2 +- .../screens/collections/MCollections.tsx | 2 +- .../mobile/screens/dashboard/MUserMenu.tsx | 2 +- .../mobile/screens/journey/MJourneyDetail.tsx | 6 +-- client/src/mobile/screens/trip/MTripShell.tsx | 10 ++-- .../mobile/screens/trip/MTripShellParts.tsx | 6 +++ .../trip/assistant/MAssistantScreen.tsx | 8 +-- .../src/mobile/screens/trip/map/MMapArea.tsx | 2 +- .../screens/trip/places/MPlacesBrowser.tsx | 2 +- .../screens/trip/plan/MPlanTimeline.tsx | 2 +- .../screens/trip/roadtrip/MRoadtripTab.tsx | 4 +- .../mobile/screens/trip/tabs/MCollabChat.tsx | 2 +- .../mobile/screens/trip/tabs/MCollabTab.tsx | 2 +- .../mobile/screens/trip/tabs/MFilesTab.tsx | 4 +- .../screens/trip/tabs/MTripTabPanel.tsx | 2 +- .../mobile/screens/trip/tabs/tabChrome.tsx | 4 +- client/src/mobile/screens/vacay/MVacay.tsx | 8 +-- client/tests/unit/mobile/MSheet.test.tsx | 2 +- client/tests/unit/mobile/shellChrome.test.tsx | 51 ++++++++++++++++++- .../unit/mobile/trip/MRoadtripTab.test.tsx | 4 +- 27 files changed, 178 insertions(+), 43 deletions(-) create mode 100644 client/src/mobile/corner.css diff --git a/client/src/mobile/MobileShell.tsx b/client/src/mobile/MobileShell.tsx index 27dbfa8f6..6198cbdf9 100644 --- a/client/src/mobile/MobileShell.tsx +++ b/client/src/mobile/MobileShell.tsx @@ -14,6 +14,7 @@ import { useNativeCapabilities } from '../native/capabilities' import { isNativeIos } from '../native/platform' import { useWindowFold } from '../native/windowFold' import './mobile.css' +import './corner.css' interface MobileShellProps { isPhone: boolean diff --git a/client/src/mobile/components/MImageViewer.tsx b/client/src/mobile/components/MImageViewer.tsx index 29ff5bd38..9e366a37c 100644 --- a/client/src/mobile/components/MImageViewer.tsx +++ b/client/src/mobile/components/MImageViewer.tsx @@ -48,7 +48,7 @@ export default function MImageViewer({ type="button" onClick={onClose} aria-label={t('collab.chat.closeImage')} - className="absolute end-4 top-[calc(var(--m-safe-top,12px)+4px)] z-10 flex h-10 w-10 items-center justify-center rounded-full bg-[color:var(--m-viewer-btn)] text-[color:var(--m-viewer-ink)]" + className="m-corner-beside absolute end-4 top-[calc(var(--m-safe-top,12px)+4px)] z-10 flex h-10 w-10 items-center justify-center rounded-full bg-[color:var(--m-viewer-btn)] text-[color:var(--m-viewer-ink)]" > diff --git a/client/src/mobile/components/MSectionNav.tsx b/client/src/mobile/components/MSectionNav.tsx index 14eec1646..93d3ab51e 100644 --- a/client/src/mobile/components/MSectionNav.tsx +++ b/client/src/mobile/components/MSectionNav.tsx @@ -89,7 +89,7 @@ export function MSectionList({ * width on both screens. */ export const SECTION_SCREEN = - 'px-4 pb-[calc(var(--bottom-nav-h,84px)+16px)] pt-[var(--m-safe-top,12px)] wide:mx-auto wide:max-w-[1040px] wide:px-6 split:grid split:max-w-[1240px] split:grid-cols-[260px_minmax(0,1fr)] split:items-start split:gap-8'; + 'm-corner-flow px-4 pb-[calc(var(--bottom-nav-h,84px)+16px)] pt-[var(--m-safe-top,12px)] wide:mx-auto wide:max-w-[1040px] wide:px-6 split:grid split:max-w-[1240px] split:grid-cols-[260px_minmax(0,1fr)] split:items-start split:gap-8'; interface MSectionNavProps { title: string; diff --git a/client/src/mobile/components/MSheet.tsx b/client/src/mobile/components/MSheet.tsx index 9be381238..7d33da0eb 100644 --- a/client/src/mobile/components/MSheet.tsx +++ b/client/src/mobile/components/MSheet.tsx @@ -86,11 +86,11 @@ type MSheetWideAnchor = 'center' | 'rail-foot' * docked sheet just above the dock; neither lies across the dock. */ const REGION: Record = { - card: 'inset-x-[14px] top-[var(--m-safe-top,12px)] bottom-[calc(var(--bottom-nav-h,84px)+12px)] justify-center', + card: 'inset-x-[14px] top-[max(var(--m-safe-top,12px),var(--m-corner-clear,0px))] bottom-[calc(var(--bottom-nav-h,84px)+12px)] justify-center', // On a phone on its side the gap it keeps at the top would leave it a strip // of a few rows, so there it may rise nearly to the top. bottom: - 'inset-x-4 top-[calc(var(--m-safe-top,12px)+56px)] bottom-[calc(var(--bottom-nav-h,84px)+16px)] justify-end short:top-[calc(var(--m-safe-top,12px)+8px)]', + 'inset-x-4 top-[max(calc(var(--m-safe-top,12px)+56px),var(--m-corner-clear,0px))] bottom-[calc(var(--bottom-nav-h,84px)+16px)] justify-end short:top-[calc(var(--m-safe-top,12px)+8px)]', drawer: 'start-0 top-0 bottom-0 w-[78%] max-w-[320px]', } @@ -116,7 +116,8 @@ const SHORT_FORM_BOX = 'short:max-w-[640px] short:flex-1' function regionClass(variant: MSheetVariant, anchor: MSheetWideAnchor = 'center', form = false): string { const base = 'pointer-events-none absolute flex flex-col' if (variant === 'drawer') return `${base} ${REGION.drawer}` - return `${base} ${REGION[variant]} ${WIDE_REGION[anchor]}${form ? ` ${SHORT_FORM_REGION}` : ''}` + // m-corner-side: on a wide window the sheet keeps off a corner element's side (a Duo's status capsule). + return `${base} m-corner-side ${REGION[variant]} ${WIDE_REGION[anchor]}${form ? ` ${SHORT_FORM_REGION}` : ''}` } /** The sheet's own box inside the region: its width, and the arrow when it has one. */ diff --git a/client/src/mobile/corner.css b/client/src/mobile/corner.css new file mode 100644 index 000000000..92373e4d9 --- /dev/null +++ b/client/src/mobile/corner.css @@ -0,0 +1,31 @@ +/* ── An element in a top corner (an iPhone Duo's status capsule) ────────────── + Beside mobile.css, which holds the variables these read (--m-corner-*). + For the screens that place their own controls rather than sit in .m-page + (the trip, its map). Every variable is 0 without such an element, so these + change nothing on any other device. + m-corner-beside: a control row in the corner's height ends before it. + m-corner-side: a layer that fills the page ends before the corner's side on + a wide window (--m-corner-side-*, 0 upright, where content starts below the + corner through --m-corner-clear instead). + The element sits where the hardware puts it, whatever the reading + direction, so right to left swaps the two sides back. */ +.m-corner-beside { + margin-inline: var(--m-corner-l-gap, 0px) var(--m-corner-r-gap, 0px); +} +html[dir='rtl'] .m-corner-beside { + margin-inline: var(--m-corner-r-gap, 0px) var(--m-corner-l-gap, 0px); +} +.m-corner-side { + margin-inline: var(--m-corner-side-l, 0px) var(--m-corner-side-r, 0px); +} +html[dir='rtl'] .m-corner-side { + margin-inline: var(--m-corner-side-r, 0px) var(--m-corner-side-l, 0px); +} +/* m-corner-beside-in: m-corner-beside for a row inside .m-page, upright only + (on a wide window the page itself already ends before the corner). */ +.m-corner-beside-in { + margin-inline: var(--m-corner-in-l, 0px) var(--m-corner-in-r, 0px); +} +html[dir='rtl'] .m-corner-beside-in { + margin-inline: var(--m-corner-in-r, 0px) var(--m-corner-in-l, 0px); +} diff --git a/client/src/mobile/mobile.css b/client/src/mobile/mobile.css index fbbf56b7b..b0d39995a 100644 --- a/client/src/mobile/mobile.css +++ b/client/src/mobile/mobile.css @@ -86,6 +86,23 @@ * the air is 0 too (min() of 0 and 8px). */ --m-safe-l-gap: calc(var(--m-bar-l) + min(var(--m-bar-l), 8px)); --m-safe-r-gap: calc(var(--m-bar-r) + min(var(--m-bar-r), 8px)); + /* The corner element alone, with the same air, for the screens that place + * their own controls (the trip, the map): a control row in the corner's + * height ends this far from the screen's side (m-corner-beside). Physical + * sides, as the element is: right to left does not move it. */ + --m-corner-l-gap: calc(var(--trek-native-corner-left, 0px) + min(var(--trek-native-corner-left, 0px), 8px)); + --m-corner-r-gap: calc(var(--trek-native-corner-right, 0px) + min(var(--trek-native-corner-right, 0px), 8px)); + /* Where the content of a screen that places its own scroll body begins at + * the latest, so its first row is not under the corner element: just below + * it (m-corner-below). Upright that is the cheaper way round; on a wide + * window the page gives up the corner's side instead (below). 0 elsewhere. */ + --m-corner-clear: calc(var(--m-corner-b) + min(var(--m-corner-b), 10px)); + --m-corner-side-l: 0px; + --m-corner-side-r: 0px; + /* The same air for a control row inside .m-page, which on a wide window has + * already given up the corner's side (m-corner-beside-in). */ + --m-corner-in-l: var(--m-corner-l-gap); + --m-corner-in-r: var(--m-corner-r-gap); /* The navigation rail's share of the leading edge (wide windows only), what * every full-width fixed bar and the page column start after. */ --m-rail-w: 0px; @@ -98,10 +115,21 @@ * reads the same values as the shell. */ html:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-root { --bottom-nav-h: env(safe-area-inset-bottom, 0px); - --m-rail-w: calc(var(--m-safe-l) + 100px); + --m-rail-w: calc(var(--m-bar-l) + 100px); + /* A wide window gives up the corner element's side over the whole height, + * as an iPhone on its side does for its camera: on an unfolded Duo lifting + * every page below the status capsule cost a quarter of the height. The + * rail already takes the leading side, so only the trailing side's corner + * counts here. */ + --m-corner-clear: 0px; + --m-corner-side-r: var(--m-corner-r-gap); + --m-corner-in-l: 0px; + --m-corner-in-r: 0px; } html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-root { - --m-rail-w: calc(var(--m-safe-r) + 100px); + --m-rail-w: calc(var(--m-bar-r) + 100px); + --m-corner-side-l: var(--m-corner-l-gap); + --m-corner-side-r: 0px; } .dark .m-root { @@ -631,13 +659,30 @@ html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m- the leading inset on a wide window. */ .m-page { margin-inline: var(--m-page-l, 0px) var(--m-page-r, 0px); - padding-top: max(0px, calc(var(--m-corner-b, 0px) + 12px - var(--m-safe-top, 12px) - 70px)); + padding-top: max(0px, calc(var(--m-corner-clear, 0px) + 2px - var(--m-safe-top, 12px) - 70px)); } html[dir='rtl'] .m-page { margin-inline: var(--m-page-r, 0px) var(--m-page-l, 0px); } +/* The lift above counts on a floating top bar over the page. A screen whose + first row is part of the page (m-corner-flow: settings, administration, + collections) is lifted until that row starts below the corner element; one + that keeps clear of it by itself (m-corner-own: a map under its own bars, a + calendar under its own header) is not lifted at all. */ +.m-page:has(.m-corner-flow) { + padding-top: max(0px, calc(var(--m-corner-clear, 0px) - var(--m-safe-top, 12px))); +} +.m-page:has(.m-corner-own) { + padding-top: 0; +} +/* On a wide window the page starts at the top and ends before the corner + element instead (--m-corner-side-*, 0 without one). */ html:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-page { margin-inline-start: 0; + margin-inline-end: max(var(--m-page-r, 0px), var(--m-corner-side-r, 0px)); +} +html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-page { + margin-inline-end: max(var(--m-page-l, 0px), var(--m-corner-side-l, 0px)); } /* A screen whose background is a map reaches under the rail: the map runs to the window's edge and the rail floats over it like the top controls do. Its diff --git a/client/src/mobile/screens/atlas/MAtlas.tsx b/client/src/mobile/screens/atlas/MAtlas.tsx index 0db3037c4..95fef29ae 100644 --- a/client/src/mobile/screens/atlas/MAtlas.tsx +++ b/client/src/mobile/screens/atlas/MAtlas.tsx @@ -122,7 +122,7 @@ export default function MAtlas() { return ( // h-dvh, not h-full: the shell stopped providing a definite height (#1809) // and a map on a percentage of an auto-height parent collapses to zero. -
+
{/* Region hover tooltip — positioned imperatively by useAtlas. */}
o.label.toLowerCase().includes(q)).slice(0, 6) : suggestions - const scrimCls = 'm-fade-in fixed inset-0 z-[70] flex flex-col bg-[rgba(16,16,19,.28)] px-[18px] pt-[calc(var(--m-safe-top,12px)+12px)] backdrop-blur-[22px] backdrop-saturate-[1.6] wide:pt-[calc(var(--m-safe-top,12px)+72px)] wide:[&>*]:mx-auto wide:[&>*]:w-full wide:[&>*]:max-w-[640px]' // theme-lint-disable — fixed scrim value from the design + const scrimCls = 'm-fade-in fixed inset-0 z-[70] flex flex-col bg-[rgba(16,16,19,.28)] px-[18px] pt-[max(calc(var(--m-safe-top,12px)+12px),var(--m-corner-clear,0px))] backdrop-blur-[22px] backdrop-saturate-[1.6] wide:pt-[calc(var(--m-safe-top,12px)+72px)] wide:[&>*]:mx-auto wide:[&>*]:w-full wide:[&>*]:max-w-[640px]' // theme-lint-disable — fixed scrim value from the design return (
{split && (