Skip to content

Epic: layout and type adapt to the phone's viewport, keyboard and text size #2596

Open
0 of 8 issues completed

Description

@schlessera

Outcome

On an Android phone, the app's layout and type follow the space actually available. Scroll caps follow the visible viewport, so they never extend under browser chrome. Fields grow with their text through CSS rather than script measurement. Components size from their own container, and headings wrap evenly. The OS text-size setting and destination-change motion each end with a written answer: either shipped, or a documented "no" that records why.

Why now

These findings come from a review of the PWA against Google Chrome's public modern-web-guidance skill (https://github.com/GoogleChrome/modern-web-guidance). The guides concerned are css/responsive-design, css/size-aware-styling, css/css-layout, forms/form-fields-automatically-fit-contents, visual-design/improve-text-layout-and-legibility, visual-design/typography, accessibility/respect-os-text-scale, ui-atoms/scrollability-affordance-hints and ui-behaviors/same-document-transitions. Most of the work removes script that the platform now does natively, which makes it cheap, low-risk polish. The type-scale and transition items are judgements and are filed for design.

Shared context

Browser-support policy. The targets are typical Android PWA browsers:

  • Chrome for Android stable (the installed WebAPK) must keep full function.
  • Samsung Internet current (v30, which is Chromium 143 per MDN browser-compat-data) must keep full function.
  • Firefox for Android must degrade gracefully.
  • Anything missing from either Chromium target needs feature detection and a named fallback. No polyfill dependencies.

The host app owns index.html, the manifest and the viewport meta. brain-kit ships the building blocks.

Support for the features used in this epic, per MDN browser-compat-data:

Feature Chrome Android Samsung Firefox Android
field-sizing 123 27 152
dvh/svh units 108 21 101
@container size queries 105 yes 110
text-wrap: balance 114 23 121
text-wrap: pretty 117 24 no
@container scroll-state() 133 29 no
<meta name="text-scale"> 146 no no
document.startViewTransition 111 22 144

Where things live:

  • Kit styles are inline style objects in packages/ui-kit/src/**/*.tsx, plus class rules in packages/ui-kit/src/tokens.css.
  • Consumer styles are Tailwind classes plus packages/ui-react/src/theme.css.
  • Browser proof runs in the pinned offline Playwright image through node scripts/visual.mjs:
    • --project=ui-react-layout runs packages/ui-react/tests/browser/*.layout.tsx.
    • --project=storybook --filter=<X>.stories runs kit stories.
    • bun run visual runs the curated baselines, and bun run visual:update rewrites them.

Prior art. The composer already sizes with field-sizing: content (fieldSizing, packages/ui-kit/src/chrome/Composer.tsx:300). That choice is recorded in the composer follows soft wrap (docs/decisions/design-kit/components-and-interactions.md:794-831), which explicitly refuses both scrollHeight measurement and the stacked-grid mirror.

Constraints and non-goals

Breakdown

  1. ui-react: remove the dead .composer-grow CSS and retarget the typing benchmark #2597: remove the dead .composer-grow mirror CSS and retarget the typing benchmark at the live composer.
  2. ui-kit: ask-form textareas grow with field-sizing instead of measuring scrollHeight #2598: ask-form textareas grow with field-sizing: content instead of measuring scrollHeight, so the "Other" answer grows too.
  3. ui-kit, ui-react: height caps use dvh so they follow the visible viewport #2599: every vh height cap becomes dvh.
  4. ui-react: size-only media queries move to CSS, with a container query for the stats bar #2600: the three JavaScript media queries that only change a size become CSS. The stats bar gets a container query, and the short-screen voice rows get @media.
  5. ui-kit: balance short headings and wrap captions pretty #2601: short headings get text-wrap: balance, and captions get pretty.
  6. ui-react: drive the Settings tab-strip overflow cue with a scroll-state container query #2602: the Settings tab-strip overflow cue becomes a scroll-state container query.
  7. ui-kit: record the accepted OS text-scale type policy and file its implementation briefs #2603 (policy accepted): record root-relative type, the staged exact-value/nine-step scale, icon-only phone tabs above 125% and the verified em-query/container fallback; file the scoped migrations. Host opt-in lands last.
  8. ui-react: record the accepted destination crossfade and its D54 exception, and file its implementation briefs #2604 (policy accepted): record the 120ms main-region crossfade and explicit D54 view-change-close exception; file the scoped styles/helper/prefetch follow-ups.

Items 1–6 are independent of each other. Item 7 gates the host's text-scale meta in schlessera/brain-hosting-template#34.

Definition of done

  • grep -rnE '(^|[^a-z0-9.])[0-9.]+vh\b' packages/ui-kit/src packages/ui-react/src finds no code.
  • No component in ui-kit or ui-react reads scrollHeight to size a field.
  • Items 7 and 8 have accepted, durably recorded answers and any required scoped implementation follow-ups filed natively under this epic. Those two issues produce decisions/designs rather than carrying the full migrations. An accepted documented no satisfies its branch; an adopted change requires its follow-ups and the stated product outcome to be verified before this epic closes.
  • Every changed baseline went through visual review in its PR.

2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: reconciled #2603/#2604's supplied proposals and current needs: decision labels with the breakdown. Corrected the definition of done so decision-producing children are not represented as full migrations; adopted implementation outcomes still require their own completed follow-ups before parent closure. No type-unit, motion or breakpoint policy is selected; preserve p3, native children and no epic readiness.

2026-10-22 later-ruling reconciliation: the maintainer accepted #2603’s type policy (comment6338093190) and #2604’s crossfade/D54 amendment (comment6338054075). Their briefs now proceed to durable records and scoped native follow-ups, not full migrations in those two issues. The accepted view-change-close exception must be recorded before its implementation; every ordinary overlay close remains instant. Existing definition-of-done product proof, native scope and no-epic-readiness rule remain. No runtime outcome is inferred.

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

2026-11-04 triage at main 53b862123d7b8e4c9d039859fabdc9fc6ad4cd36: Refreshed the active named-source navigation after inspecting the current declarations; existing decisions, historical receipts, child prerequisites and readiness remain unchanged. No new runtime qualification or implementation is claimed.

Triage 2026-11-08 at main 8752570331ffebdbb9233196412781f6cd71f3d9: Verified the moved active source anchors and refreshed navigation. Historical measurements and source-bound failure receipts keep their identities; existing scope, rulings, needs, priority, assignment and release attribution are preserved. This source review supplies no new runtime qualification or epic completion.

Triage 2026-11-09 at main 9c7eb25825fdad5f4485db0df472188805edb450: Verified the moved active declaration/use and repaired its navigation. Commit-bound historical failures and source ranges retain their identities; scope, rulings, child prerequisites, priority and no epic readiness are preserved. This source review is not a new runtime result.

2026-11-16 source refresh at main 43d73cbe6: Verified the actual 85dvh dialog and 70dvh sheet-cap passages after the image-editor record insertion. Existing decisions, native outputs and epic readiness remain unchanged; no new runtime proof is claimed.

Activity

  1. added
    type: feat
    area: ui-react
    area: ui-kit
    priority: p3
    epic
    on Oct 22, 2026
  2. schlessera commented on Oct 22, 2026

    @schlessera
    OwnerAuthor

    2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: reconciled #2603/#2604's supplied proposals and current needs: decision labels with the breakdown. Corrected the definition of done so decision-producing children are not represented as full migrations; adopted implementation outcomes still require their own completed follow-ups before parent closure. No type-unit, motion or breakpoint policy is selected; preserve p3, native children and no epic readiness.

  3. schlessera commented on Oct 22, 2026

    @schlessera
    OwnerAuthor

    2026-10-22 later-ruling reconciliation: the native breakdown now reflects accepted #2603 root-relative type and #2604’s 120ms crossfade, including the explicit view-change-only D54 exception. Their remaining scope is durable records and scoped follow-up issues; the parent still requires delivered and verified implementation outcomes. No migration, animation runtime, baseline approval or epic readiness is claimed.

  4. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main 3aadc8df5: citation drift only: D22's "one ambient animation" is at components-and-interactions.md:124 (was 122). All eight children remain open; no merged PR since the 2026-11-04 pass references them. Breakdown, labels and native membership unchanged.

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

    area: ui-kitarea: ui-reactepicpriority: p3type: feat

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions