Repository navigation
Description
Outcome
Menus, panels, pickers and form controls in @schlessera/brain-ui-kit and @schlessera/brain-ui-react take their dismissal, keyboard and input behaviour from the platform. On an installed Android PWA the system back gesture closes the open panel instead of leaving the app. Menus expose only the ARIA contract they implement, Enter never submits half-composed IME text, and switches, disclosures and actions are native elements that need no hand-written key handlers. Every new platform feature is feature-detected and keeps a working fallback.
Why now
A review of the UI against Google Chrome's public modern-web-guidance skill found that modal overlays are already native (<dialog> + showModal(), D54), but nothing outside them is. Before #2577, non-modal destination panels and the ≥900px panes listened only for an Escape keydown, so on Android the back gesture could exit the installed app while Sessions, Files or Settings was open. D52 N2 already requires "Esc, back, or Close …" to close a panel. Every route write is history.replaceState, so Back also has no in-app history to walk. The same review found ARIA menus with no menu keyboard contract, IME-unsafe Enter handlers in nine places, and a long tail of div role="button" controls with hand-written Enter/Space handling.
Shared context
Browser-support policy for every task:
- Chrome for Android stable (installed WebAPK) and Samsung Internet current (v30, Chromium 143) keep full function.
- Firefox for Android degrades gracefully.
- Anything not supported in both Chromium targets gets feature detection and a named fallback. No polyfill dependencies.
- The host app outside this repo owns
index.html, the manifest and the built service worker. brain-kit ships the building blocks.
Support data (MDN browser-compat-data; Chrome Android / Samsung Internet / Firefox Android):
| Feature | Chrome A. | Samsung | Firefox A. |
|---|---|---|---|
popover |
114 | 23 | 125 |
anchor-name |
125 | 27 | 147 |
position-try-fallbacks |
128 | 28 | 147 |
CloseWatcher |
126 | 28 | 149 |
<details name> |
120 | 25 | 130 |
::details-content |
131 | 29 | 143 |
What already exists and stays:
- Modal overlays are native: (
const cancel,packages/ui-kit/src/chrome/Overlay.tsx:106-116) prevents the cancelablecancelevent and re-opens on a non-cancelable close-watcherclose. Do not rework the modal path. - Non-modal destination panels still render as sections (
<section,packages/ui-kit/src/chrome/Overlay.tsx:222). The stack registers their close requests (registerOverlay,packages/ui-kit/src/internal/overlay-stack.ts:19-52). ui-kit: Android back leaves the app instead of closing an open destination panel or pane #2577 added feature-detected CloseWatcher for Android Back and native Escape. The document keydown path covers the fallback and, since ci: main red at cc108216fc41: browser #4230, dispatched Escape. - Roving tabindex lives in
packages/ui-kit/src/internal/roving.ts(design-feedback §11). It is not exported through@schlessera/brain-ui-kit/internalyet.
Binding records:
- overlays.md D54: layer table, "Closing is instant", Escape goes to the topmost overlay only.
- sessions-and-drafts.md D52 N1–N3: a panel is not a place, and Esc or back closes it and returns focus.
- components-and-interactions.md: D27 (Disclosure's three modes), D55 (native icon/text actions and the raw-button vocabulary).
- tokens-and-styles.md D34: hit targets are reach past the paint.
- design-feedback.md §11: composite widgets use a roving tabindex.
Existing issues this epic references but does not own: #1474 (kit Button becomes a native button), #1919 (phone graph list controls). #1810 (Composer IME) is attached here as a child. #2166's Toggle reduced-motion fix is folded into #2585.
Pre-1.0, an approved break in any task ships as a minor changeset naming the break, never a major one (maintainer, 2026-10-24).
Constraints and non-goals
- Do not change pixels unless a task says so. Existing visual baselines stay green.
- No new motion. D54 "Closing is instant" holds.
- No polyfills (
@oddbird/popover-polyfill, anchor-positioning polyfill,input-switch-polyfill). - Contract: kit/react prop types stay as they are unless a task names the change. A rendered-element change that alters a documented prop or ref type goes through contract-versioning.md.
- Not in this epic: the connection banner's behaviour under a modal. D54 explicitly accepts that the banner is inert and unannounced while a modal is open.
- Not in this epic: removing framer-motion, PWA install/manifest work, or anything the host app owns.
Breakdown
- ui-kit: Android back leaves the app instead of closing an open destination panel or pane #2577: delivered through fix(ui-kit,ui-react): close non-modal panels on Android back (#2577) #4194 (
cc108216f). OneCloseWatcherhelper handles non-modal panels, panes and the desktop dictation popover. - ui-react: Attach and Share popovers claim role=menu without the menu keyboard contract #2578: drop
role="menu"andaria-haspopup="menu"where no menu keyboard contract exists. - ui-react: Enter in text fields outside the Composer acts on half-composed IME input #2579: one IME-safe Enter helper for every text-field Enter handler outside the Composer, plus
enterKeyHint. - ui-react: the theme radiogroup is three tab stops with no arrow keys #2580: the theme radiogroup becomes native radios (one tab stop, arrow keys).
- ui-kit: modal overlays let overscroll chain to the page underneath #2581: modal overlays contain overscroll natively. The root scroll lock stays.
- ui-react: Back has no in-app history because every route write replaces the entry #2582: destinations and deliberate drill-ins push history entries under the accepted bounded-C ruling (Chat base, one replaceable Actions/Graph slot, drill-ins before panel dismissal, session resume as a drill-in). Coordinates with task 1 through its close-watcher arm/disarm control.
- ui-kit: anchored menus and pickers hand-roll dismissal and clip instead of using native popovers #2583: Share, Provider picker, desktop Attach, desktop ModelPicker and Session overflow move to
popover="auto"top-layer popovers under the accepted ruling, amending D54's layer table. - ui-kit: Disclosure hand-rolls a toggle button instead of rendering details/summary #2584:
Disclosurerenders<details>/<summary>and keeps D27's three modes. - ui-kit: Toggle hand-rolls a span switch instead of a native checkbox #2585:
Togglerenders a native checkbox withrole="switch", and its motion honours reduced motion (absorbs ui-kit: Toggle inline transitions override reduced-motion styling #2166). - Epic: actionable rows, cards and Composer controls are native buttons #2586 (sub-epic): the accepted leaf controls (Composer, conversation controls, rows, cards, image/selector integration) become native buttons, one child task per group.
Tasks 1–5 can land in any order. Task 6's combined drill-in proof runs once task 1 has landed. Task 7 is easier after task 2. Task 10 follows the pattern #1474 sets for Button.
Definition of done
- On a Chromium browser test, a close request (Escape, which Chromium routes through the same close-watcher path as Android back) closes the topmost open panel exactly once and never navigates history. Where
CloseWatcheris unavailable, the existing Escape keydown fallback still closes it. - No element in either package carries
role="menu",menuitemoraria-haspopup="menu"without arrow-key navigation. - Every custom Enter handler on a text field ignores composing keystrokes.
- Tasks 6, 7 and 10 are implemented on their accepted branches, not merely ruled: Back walks drill-ins before closing a panel with one action per gesture (6), the listed menus are top-layer popovers with D54 amended (7), and every accepted
div role="button"control is a native button (10). Their rulings are recorded innavigation.md,overlays.mdand D55 respectively. - No polyfill was added. Every newly used platform feature has a named fallback exercised by a test.
2026-10-24: tasks 6, 7 and 10 now carry accepted rulings, so the breakdown and definition of done require their implementation rather than a ruling that may end in "no"; #2586 is a sub-epic; #2166 folds into #2585; #1810 is a child; pre-1.0 breaks ship as minor changesets.
2026-10-26 triage at main c670449d3bf1b0639e50ce554d728961f4313add: verified the current cited code and corrected literal source anchors/start lines. This navigation correction preserves historical receipts, decisions, scope, classification and unresolved prerequisites; no new runtime result or readiness is inferred.
2026-11-02 triage at main a84d9bfbcb4e608b504aa0a9feb1144ad9a0b77e: Reverified modal cancel/close recovery, the non-modal section and the existing Escape owner. Refreshed moved Overlay pointers; all accepted native-control/Back policies and actual-browser proof requirements remain unchanged. Keep the epic outside agent-ready.
2026-11-15 triage at main 3f8ff29341fbe25665cea42659f92e6f3d3ccef0: Made the non-modal Overlay citation start on its actual section-rendering line; dismissal, Back and fallback requirements are unchanged.
2026-11-17 triage at main d974052166f335cbf57b385fddc13875da1b98de: Verified the modal cancel/close handlers and non-modal section after the additive Overlay description prop. Interaction policy and remaining child proof are unchanged.
2026-11-20 triage — Reconciled #2577 and its dispatched-Escape follow-up with main bd751d434.
Activity
schlessera commentedon Nov 20, 2026
Epic state — 2026-11-20. #2577 is closed through #4194 (
cc108216f). #4230/#4231 retains the dispatched-Escape path. The remaining native work is #2578–#2586 and #1810. The epic definition of done still owns the complete browser and Android evidence.