The bottom nav rendered under the Android navigation bar, and full-screen
playback controls spilled into unusable screen edges. It looked device-specific
(Motorola bad, Fairphone fine) but every device was equally unpadded — only the
intrusion differed: a tall opaque 3-button bar swallows the nav, a thin
translucent gesture pill overlaps harmlessly.
None of the app's safe-area handling was ever active, for two independent
reasons:
1. app.html had no `viewport-fit=cover`, so every `env(safe-area-inset-*)`
resolved to 0px — the padding in app.css and BottomUi was a no-op.
2. Android WebView maps only the *display cutout* into `env()`; the status bar
and navigation bar are never reported. With enableEdgeToEdge() and
targetSdk 36 (enforced from 35, opt-out ignored from 36) the WebView always
spans them, so CSS could not learn about them by any route.
WindowInsetsBridge now reads `systemBars() | displayCutout()` and publishes
`--jt-inset-*` CSS custom properties, both pushed on every inset change
(rotation, nav-mode switch, PiP) and pullable via `AndroidInsets.get()` — the
pull is required because the first inset pass lands before the document exists
and a page load wipes the pushed inline style. app.css folds them with `env()`
via `max()` into `--safe-*`, the only thing components may pad from.
Exactly one element owns each edge: the shell takes top/left/right, BottomUi
takes bottom (inside its surface box, so the colour extends behind the gesture
bar), and shellReservesBottomInset hands bottom back to the shell on routes with
no bottom UI. The full-screen players inset their control layers only, leaving
video and artwork edge-to-edge.
The theme's `fitsSystemWindows=true` claimed the opposite of what actually
happened — overridden at runtime, ignored at this target SDK — and is removed.
Also converts six nested `h-screen`/`min-h-screen` boxes to `h-full`: the shell
is `h-screen` *and* inset-padded, so its content box is `100vh - safe-top` and
any nested 100vh box overflows by exactly the inset (the library column would
have clipped its own BottomUi). A test guards against reintroduction.
72 lines
2.6 KiB
Svelte
72 lines
2.6 KiB
Svelte
<!--
|
|
BottomUi — the app's bottom UI (mini player stacked over the bottom nav).
|
|
|
|
Rendered as an IN-FLOW flex child at the bottom of a full-height flex column,
|
|
NOT a fixed overlay. This is the whole point: because it is a normal flex
|
|
sibling below the scroll container (which is `flex-1 min-h-0 overflow-y-auto`),
|
|
the scroller is physically bounded above it and can never render behind it.
|
|
|
|
This replaces the old ResizeObserver + `bottomUiHeight` + padding-reservation
|
|
scheme, which started at 0, updated async, and repeatedly regressed into the
|
|
"last row hidden behind the nav" bug. There is nothing to measure or reserve:
|
|
the browser's flex layout does it exactly, every frame.
|
|
|
|
The Android navigation/gesture bar is cleared via `--safe-bottom` (see
|
|
app.css). The padding sits INSIDE this element's `bg-surface` box on purpose,
|
|
so the surface colour extends behind the gesture bar instead of leaving a
|
|
strip of page background under the nav.
|
|
|
|
Never pad from a bare CSS `env()` safe-area value here: Android WebView does
|
|
not report the system bars that way, so it is always 0 and the nav ends up
|
|
under the navigation bar (UR-066).
|
|
|
|
TRACES: UR-005, UR-066 | DR-009, DR-112
|
|
-->
|
|
<script lang="ts">
|
|
import { goto } from "$app/navigation";
|
|
import { currentMedia, isPlaying, playbackPosition, playbackDuration } from "$lib/stores/player";
|
|
import { isShuffle, repeatMode, hasNext, hasPrevious } from "$lib/stores/queue";
|
|
import { showSleepTimerModal } from "$lib/stores/appState";
|
|
import MiniPlayer from "$lib/components/player/MiniPlayer.svelte";
|
|
import BottomNav from "$lib/components/BottomNav.svelte";
|
|
|
|
let {
|
|
showMiniPlayer = true,
|
|
showNav = true,
|
|
onExpand,
|
|
}: {
|
|
showMiniPlayer?: boolean;
|
|
showNav?: boolean;
|
|
// Where "expand mini player" goes. Defaults to the full player route.
|
|
onExpand?: () => void;
|
|
} = $props();
|
|
|
|
function expand() {
|
|
if (onExpand) return onExpand();
|
|
if ($currentMedia) goto(`/player/${$currentMedia.id}`);
|
|
}
|
|
</script>
|
|
|
|
<!-- flex-shrink-0 so it keeps its natural height; the scroller sibling flexes. -->
|
|
<div class="flex-shrink-0 pb-[var(--safe-bottom)] bg-[var(--color-surface)]">
|
|
{#if showMiniPlayer}
|
|
<MiniPlayer
|
|
media={$currentMedia}
|
|
isPlaying={$isPlaying}
|
|
position={$playbackPosition}
|
|
duration={$playbackDuration}
|
|
shuffle={$isShuffle}
|
|
repeat={$repeatMode}
|
|
hasNext={$hasNext}
|
|
hasPrevious={$hasPrevious}
|
|
className="flex-shrink-0"
|
|
onExpand={expand}
|
|
onSleepTimerClick={() => showSleepTimerModal.set(true)}
|
|
/>
|
|
{/if}
|
|
|
|
{#if showNav}
|
|
<BottomNav className="flex-shrink-0" />
|
|
{/if}
|
|
</div>
|