Skip to content

Epic: the PWA uses current web-platform features without dropping Android targets #2553

Open
0 of 11 issues completed

Description

@schlessera

Outcome

The PWA's UI, sign-in, offline and notification layers use current web-platform features wherever those replace hand-written JavaScript or fix behaviour the platform already gets right. Every replacement keeps full function on the Android targets the app is installed on: Chrome for Android and Samsung Internet. Firefox for Android degrades gracefully, never to a broken screen.

Why now

A review of ui-kit, ui-react, ui-sdk/src/client and the auth routes in ui-server was run against Google Chrome's modern-web-guidance skill on 2026-10-22. The reviewers then hand-checked its findings. It found:

  • Real defects. Android Back leaves the installed app from every screen. IME composition sends early outside the Composer. Animations ignore reduced motion. Passkey autofill stops re-arming after a cancel. A duration formatter prints 1m 60s.
  • Responsiveness on phones. While an answer streams, the whole markdown answer is re-parsed every animation frame: 21–40 ms per frame at 16–24 KB on desktop. No phone measurement or desktop-to-phone factor has been established; device evidence is part of Epic: streaming answers and heavy views stay responsive on mid-range Android phones #2587's proof.
  • Code the platform now covers. About 70 lines of outside-click, Escape and focus-wrap code across five menus. A 43 KB gzip animation library used for fades. A WebAuthn wrapper library the passkey guidance says not to use on the client.

The review also reported the offline banner being hidden behind modal dialogs. That is not a defect: D54 explicitly accepts that the connection banner is inert and unannounced while a modal is open (docs/decisions/design-kit/overlays.md:74), and #2576 excludes it.

The sub-epics group the findings by surface, so each can be picked up and judged on its own.

Shared context

Browser-support policy. This applies to every sub-issue.

  • Chrome for Android stable (installed WebAPK) and current Samsung Internet must keep full function. The pinned MDN browser data lists Samsung Internet 30 on Chromium 143. An upstream engine version is a planning lead; verify each feature’s actual support and exercise its named fallback rather than treating the engine number as runtime proof.
  • A feature newer than that, or missing from either Chromium browser, ships behind feature detection (@supports, 'X' in window) with a named fallback.
  • Firefox for Android may get the fallback, or no enhancement, but never a broken flow.
  • No polyfill dependencies.

Where the code lives.

  • packages/ui-kit owns presentational components and tokens.
  • packages/ui-react owns the app's behaviour, stores and hooks.
  • packages/ui-sdk/src/client ships the service-worker, push and share-target building blocks.
  • packages/ui-server owns auth and headers.
  • The host app owns index.html, the manifest, the viewport meta and the built service-worker.js. For a self-hoster that is brain-hosting-template.

Guidance. Each sub-issue quotes the modern-web-guidance guide it relies on, or says "(no guide)" and cites browser-compat-data instead. The guide's PWA section covers only origin migration, so service-worker and push items rely on browser-compat-data.

Already modern; leave these alone.

  • Native <dialog> overlays (Overlay.tsx).
  • light-dark() theming.
  • Message-body content-visibility with a windowed transcript.
  • Page Lifecycle freeze/resume handling (connection.ts).
  • Web Locks and BroadcastChannel tab coordination.
  • Wake lock.
  • The share-target stash-and-redirect design.
  • Network-only /api in the service worker.
  • The Fetch Metadata origin policy.

Constraints and non-goals

  • No new seams (AGENTS.md). This is implementation inside existing packages.

  • Contract stability. Additive export or HTTP changes carry the contract label and update docs/integration-contract/ in the same commit. Three tasks carry maintainer-approved breaks, each with contract and breaking: ui-server: passkey and principal management need a fresh passkey verification, not just a 30-day cookie #2560 (a 403 reauth_required on guarded security routes), ui-server: the browser session cookie is named __Host-brain_ui_session #2562 (the emitted session cookie becomes __Host-brain_ui_session) and ui-sdk: a new service worker activates under a busy page and deletes the lazy chunks it still needs #2569 (required ServiceWorkerPolicyScope members for the idle-gated handover). Before 1.0.0 an approved break ships as a minor changeset that names it, never a major one (maintainer, 2026-10-24). Any other break needs its own ruling first.

  • Binding design records:

    • docs/decisions/design-kit/overlays.md (D54)
    • docs/decisions/design-kit/components-and-interactions.md (D27, D55)
    • docs/decisions/design-kit/tokens-and-styles.md (D34)
    • docs/decisions/design-kit.md

    A sub-issue that would amend one of them carries needs: decision and states the question.

  • Out of scope:

    • iOS-specific work. It is not dropped, but it is not the target of this review.
    • App Badging, Background Sync and Periodic Background Sync.
    • launch_handler, which would bypass the share-target POST.
    • Speculation Rules (the app is a single-page app).
    • WebSocketStream.
    • Temporal, which Samsung Internet does not have yet.
    • beforeinstallprompt UI.
    • closedby on Overlay. Overlay needs close reasons and refusable closes.

Breakdown

Sub-epics:

Direct tasks:

Host-side counterparts: schlessera/brain-hosting-template#34 (per-scheme theme-color and the OS text-scale opt-in) and schlessera/brain-hosting-template#38 (keyboard viewport resizing).

Definition of done

  • Every sub-epic is closed, or each remaining issue is a documented "no" or deferred with its reason.
  • Bugs are proven fixed in a real browser, not a predicate test.
  • Each adopted platform feature has a test or story showing its fallback path.
  • The decision records amended along the way are updated, and none contradicts the shipped behaviour.

2026-10-24: replaced "Nothing here is planned as breaking" with the three approved breaks (#2560, #2562, #2569) and the pre-1.0 minor-changeset rule; removed the offline banner under modals from the defects list (D54 accepts it); removed the unmeasured phone-slowdown claim; added #2594 and hosting-template #38 to the breakdown.

2026-10-29 source review at main a8e80eea1ec045579ee7d69d6019bce5e78afa5e: Corrected D34’s record to tokens-and-styles rather than the component record. The modal-banner exception, accepted child breaks and Android fallback policy remain as recorded. All eleven native children/counterparts remain open; no adopted implementation or browser proof is inferred. Preserve the existing priority, accepted rulings, exclusions and native membership; the epic remains without agent-ready. No implementation, new extension seam, runtime qualification or release commitment is supplied by this correction.

2026-11-02 triage at main a84d9bfbcb4e608b504aa0a9feb1144ad9a0b77e: Rechecked the pinned Samsung engine mapping and removed the inference that an engine version proves every feature works. The Android full-function/fallback policy, accepted child breaks and native ownership remain unchanged; no new browser qualification is claimed. Keep the epic outside agent-ready.

2026-11-16 source refresh at main 43d73cbe6: Moved the accepted modal/banner layering pointer past the newly added image-editor shell section. Existing decisions, native outputs and epic readiness remain unchanged; no new runtime proof is claimed.

Activity

  1. added
    type: feat
    area: ui-sdk
    area: ui-server
    area: ui-react
    area: ui-kit
    priority: p1
    epic
    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

    area: ui-kitarea: ui-reactarea: ui-sdkarea: ui-serverepicpriority: p1type: feat

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions