Skip to content

ui-kit, ui-react: height caps use dvh so they follow the visible viewport #2599

Open

Description

@schlessera

Context

vh is the large viewport. In a phone browser tab with the toolbar showing, a 60vh cap is 60% of a height the user cannot currently see, so capped panels run under the browser chrome. The kit has already settled on dynamic units: overlay caps are written in dvh (docs/decisions/design-kit/overlays.md:23, :64; packages/ui-kit/src/tokens.css:2384, :2451, :2471). The phone handoff sheet uses 92dvh too (packages/ui-react/src/components/chat/handoff-sheet.tsx:344). But 18 vh values on 17 lines in 13 files remain:

File Line Value
packages/ui-kit/src/internal/sheet-dialog.tsx 45 min(60vh, 520px)
packages/ui-kit/src/chrome/ModelPicker.tsx 72 calc(85vh - 90px) / 72vh
packages/ui-kit/src/chrome/ModelPicker.tsx 75 30vh
packages/ui-kit/src/chrome/ModelPicker.tsx 158 80vh
packages/ui-kit/src/tokens.css 2308 .bk-follow-up-box min(50vh, 320px)
packages/ui-react/src/theme.css 760-761 dictation sheet 40vh/60vh (comment at 755)
packages/ui-react/src/components/voice/dictation-sheet.tsx 167 max-h-[min(60vh,32rem)]
packages/ui-react/src/components/voice/recordings-tray.tsx 103 maxHeight: "40vh"
packages/ui-react/src/components/files/file-panel.tsx 160 max-h-[45vh]
packages/ui-react/src/components/files/file-viewer-binary.tsx 69, 107 max-h-[70vh]
packages/ui-react/src/components/chat/turn-journal.tsx 150 max-h-[60vh]
packages/ui-react/src/components/chat/journal-coverage.tsx 32 maxHeight: "50vh"
packages/ui-react/src/components/activity/activity-run-detail.tsx 238 max-h-[60vh]
packages/ui-react/src/components/report/diagnostic-review.tsx 179 max-h-[60vh]
packages/ui-react/src/components/chat/handoff-sheet.tsx 344 min(86vh, 760px) (pointer branch)

Guide css/responsive-design: "Use dynamic viewport units (dvh, dvw) instead of vh/vw to prevent layout breakage when mobile browser UI elements (like address bars) appear or disappear."

Support: Chrome Android 108, Samsung 21, Firefox Android 101 (MDN browser-compat-data). All targets have it, so no fallback is needed.

Scope

  • Replace every vh in the table with dvh, keeping each number and each min()/calc() around it. This includes the pointer-only and desktop branches, so that one rule holds everywhere.
  • Update the dictation comment at theme.css:755 to match.

Out of scope

Acceptance criteria

  • grep -rnoE '(^|[^a-z0-9.])[0-9.]+vh\b' packages/ui-kit/src packages/ui-react/src prints nothing. Before the change it prints the lines in the table.
  • A unit test in the style of packages/ui-react/tests/copy-button-css.test.ts scans packages/ui-kit/src and packages/ui-react/src and fails, naming file and line, on any vh length outside comments. It fails on the tree before the change and passes after. This rule is static, so a predicate test is the right proof. A headless browser cannot fail-first here: without a dynamic toolbar, vh and dvh resolve the same.
  • Curated visual baselines are unchanged, for the same reason. The PR shows a bun run visual pass.

Verification

grep -rnoE '(^|[^a-z0-9.])[0-9.]+vh\b' packages/ui-kit/src packages/ui-react/src
bun run visual
bun run test
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

@schlessera/brain-ui-kit and @schlessera/brain-ui-react: patch.

2026-10-24: the keyboard viewport meta moved from brain-hosting-template#34 to the new brain-hosting-template#38; reference updated.

Activity

  1. added
    type: fix
    area: ui-react
    area: ui-kit
    priority: p3
    agent-ready
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-kitarea: ui-reactpriority: p3type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions