fix(mobile): keep every screen clear of the iPhone Duo's status capsule

The capsule in a top corner was handled screen by screen: the m-corner-*
classes and --m-corner-clear put bars beside it and lifted content below
it, so every layer that did not opt in sat under it, and testers found it
on almost every page.

It now counts as safe area in mobile.css. Upright the top inset reaches
below the capsule and the sides keep their full width; on a wide window
its side is given up over the whole height instead. The per-screen
handling and corner.css are gone. Control rows a screen places itself and
layers that fill the window keep to the side insets through m-safe-row and
m-safe-trail, and the trip's pane keeps its content off the capsule's side
on a wide window. On every other device the insets come out as before.
This commit is contained in:
Maurice
2026-11-22 19:36:31 +01:00
parent c0f6551cf4
commit ea1b75e639
27 changed files with 156 additions and 236 deletions
+52 -72
View File
@@ -66,43 +66,26 @@
* publishSafeArea) is a floor under env(): where a release lays the web view
* out below the status bar, WebKit reports 0 while a camera in a corner still
* reaches into the page. In a browser the variables are unset: env() alone. */
--m-safe-t: max(env(safe-area-inset-top, 0px), var(--trek-native-safe-top, 0px));
--m-safe-l: max(env(safe-area-inset-left, 0px), var(--trek-native-safe-left, 0px));
--m-safe-r: max(env(safe-area-inset-right, 0px), var(--trek-native-safe-right, 0px));
--m-safe-top: calc(var(--m-safe-t) + 12px);
--m-raw-t: max(env(safe-area-inset-top, 0px), var(--trek-native-safe-top, 0px));
--m-raw-l: max(env(safe-area-inset-left, 0px), var(--trek-native-safe-left, 0px));
--m-raw-r: max(env(safe-area-inset-right, 0px), var(--trek-native-safe-right, 0px));
/* An element in a top corner of the screen, such as an iPhone Duo's status
* capsule, as the iOS app measures it (TrekBridgeViewController
* cornerElement): how far down it reaches and how wide it is on its side.
* The floating bars stand beside it; the page keeps the side's full width
* and starts below it, instead of giving up a strip of the whole height to
* an inset that only exists in the corner. 0 everywhere else. */
--m-corner-b: var(--trek-native-corner-bottom, 0px);
--m-bar-l: max(var(--m-safe-l), var(--trek-native-corner-left, 0px));
--m-bar-r: max(var(--m-safe-r), var(--trek-native-corner-right, 0px));
--m-page-l: max(0px, var(--m-safe-l) - var(--trek-native-corner-left, 0px));
--m-page-r: max(0px, var(--m-safe-r) - var(--trek-native-corner-right, 0px));
/* A bar's side inset plus a little air: next to a Duo's status capsule a
* bar that ends exactly at the inset reads as touching it. Without an inset
* cornerElement), counts as safe area like a notch, so every screen keeps
* clear of it without knowing it is there. Upright the top inset reaches
* below it and the sides keep their full width (iOS reports the element as
* a side inset too, which is taken back out); on a wide window its side is
* given up over the whole height instead (below), where a band across the
* top would cost a quarter of the height. 0 on every other device. */
--m-safe-t: max(var(--m-raw-t), var(--trek-native-corner-bottom, 0px));
--m-safe-l: max(0px, var(--m-raw-l) - var(--trek-native-corner-left, 0px));
--m-safe-r: max(0px, var(--m-raw-r) - var(--trek-native-corner-right, 0px));
--m-safe-top: calc(var(--m-safe-t) + 12px);
/* A side inset plus a little air, for a bar beside it: a bar that ends
* exactly at the inset reads as touching what is there. Without an inset
* 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);
--m-safe-l-gap: calc(var(--m-safe-l) + min(var(--m-safe-l), 8px));
--m-safe-r-gap: calc(var(--m-safe-r) + min(var(--m-safe-r), 8px));
/* 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;
@@ -115,21 +98,15 @@
* 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-bar-l) + 100px);
--m-rail-w: calc(var(--m-safe-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;
* as an iPhone on its side does for its camera, and keeps the top as it is. */
--m-safe-t: var(--m-raw-t);
--m-safe-l: max(var(--m-raw-l), var(--trek-native-corner-left, 0px));
--m-safe-r: max(var(--m-raw-r), var(--trek-native-corner-right, 0px));
}
html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-root {
--m-rail-w: calc(var(--m-bar-r) + 100px);
--m-corner-side-l: var(--m-corner-l-gap);
--m-corner-side-r: 0px;
--m-rail-w: calc(var(--m-safe-r) + 100px);
}
.dark .m-root {
@@ -649,40 +626,43 @@ html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-
html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-span-x {
inset-inline-end: var(--m-safe-l-gap, 0px);
}
/* A control row or button a screen places by itself (m-safe-row: the trip's
top row, the map's controls, a viewer's close button, a dropdown) keeps
clear of the sides' safe area like the bars above: both sides on a phone,
the trailing side on a wide window, where the rail holds the leading one.
A layer that fills the window (m-safe-trail: a sheet, the assistant, the
trip's pane and map) does the same on a wide window only; on a phone its
own insets keep it off the sides. On an unfolded Duo that trailing side is
the status capsule's. */
html:not(:has(.m-shell[data-size='wide'], .m-shell[data-size='split'])) .m-safe-row {
margin-inline: var(--m-safe-l-gap, 0px) var(--m-safe-r-gap, 0px);
}
html[dir='rtl']:not(:has(.m-shell[data-size='wide'], .m-shell[data-size='split'])) .m-safe-row {
margin-inline: var(--m-safe-r-gap, 0px) var(--m-safe-l-gap, 0px);
}
html:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) :is(.m-safe-row, .m-safe-trail) {
margin-inline-end: var(--m-safe-r-gap, 0px);
}
html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) :is(.m-safe-row, .m-safe-trail) {
margin-inline-end: var(--m-safe-l-gap, 0px);
}
/* The page itself keeps clear of the sides' safe area, as iOS asks of every
app, and starts below an element in a top corner: on a Duo the status
capsule ran over the cards under the top bar (TestFlight feedback). The
padding lifts the content only by what the capsule reaches below the top
bar's row (about 70px under the top clearance), so with no corner element
it is 0. Margins, so the rail's wide:ps on the same element stays; fixed
layers are the window's and keep their own rules. The rail already takes
the leading inset on a wide window. */
app. Margins, so the rail's wide:ps on the same element stays; fixed layers
are the window's and keep their own rules. On a wide window the rail takes
the leading inset, so the page starts at the rail and ends before the
trailing inset. */
.m-page {
margin-inline: var(--m-page-l, 0px) var(--m-page-r, 0px);
padding-top: max(0px, calc(var(--m-corner-clear, 0px) + 2px - var(--m-safe-top, 12px) - 70px));
margin-inline: var(--m-safe-l, 0px) var(--m-safe-r, 0px);
}
html[dir='rtl'] .m-page {
margin-inline: var(--m-page-r, 0px) var(--m-page-l, 0px);
margin-inline: var(--m-safe-r, 0px) var(--m-safe-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));
margin-inline-end: var(--m-safe-r-gap, 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));
margin-inline-end: var(--m-safe-l-gap, 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
@@ -786,7 +766,7 @@ html:has(.m-shell) [data-desktop-navbar] {
html:has(.m-shell) [data-plugin-page] {
--plugin-page-h: calc(100dvh - var(--bottom-nav-h, 0px));
box-sizing: border-box;
padding-top: env(safe-area-inset-top, 0px);
padding-top: var(--m-safe-t, env(safe-area-inset-top, 0px));
padding-inline-start: var(--m-rail-w, 0px);
}
html:has(.m-shell) .leaflet-control-zoom {