From 998901210699d6001731bd0556f080bacc4be1e8 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 15 Nov 2026 22:39:08 -0800 Subject: [PATCH 1/8] docs(TabBar): a headless useTabBar for a bar the app draws An app that draws its own tab bar gets TabBar's behavior from useTabBar, as values and props: the selection, More, names, roving focus and the lens's state. TabBar renders through it, and an action beside the tabs is never a tab. DEC-1 waits for the spec owner. --- docs/specs/components/TabBar/TabBar.spec.md | 124 +++++++++++++------- 1 file changed, 82 insertions(+), 42 deletions(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 74fd05057f255..38887f8cdf88c 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -20,22 +20,29 @@ families: [] design_specs: [] architecture: [] contributing: [] -system_specs: [spec:AST-085/FR1, spec:AST-085/FR2, spec:AST-085/FR5] +system_specs: + [ + spec:AST-085/FR1, + spec:AST-085/FR2, + spec:AST-085/FR5, + spec:AST-107/DEC-1, + spec:AST-107/FR7, + ] --- # TabBar component contract ## Contract at a glance -| Area | Contract | -| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Public contract | `TabBar` takes `moreValue` (default `'more'`); `TabBarMoreList` takes `children`, `value` and `onChange`; Core's catalog has `@astryx.tabBar.more`. | -| Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. | -| End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. | -| Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. | -| Compatibility/readiness | Five tabs or fewer render as before. Draft. | -| Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. | -| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled). | +| Area | Contract | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Public contract | `TabBar` takes `moreValue` (default `'more'`); `TabBarMoreList` takes `children`, `value` and `onChange`; `useTabBar` hands a bar the app draws the same behavior as values and props; Core's catalog has `@astryx.tabBar.more`. | +| Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. A bar drawn on `useTabBar` behaves as `TabBar` does, and an action beside the tabs is never a tab. | +| End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. A bar with an app's own look keeps the tab bar's names, keys and finger lens. | +| Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props and draws the lens from its state. | +| Compatibility/readiness | Five tabs or fewer render as before; `useTabBar` is additive. Draft. | +| Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a hook that returns a gesture recognizer or an animator, and an action inside the tab list. | +| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1 and FR7 (products get values and props, and Lab builds on the same layer). | This table is a review projection; the body below is authoritative. @@ -43,13 +50,14 @@ This table is a review projection; the body below is authoritative. TabBar is the lab's floating bar of top-level sections, modelled on UIKit's tab bar. This record states how it holds more sections than fit, how disabled -tabs meet the keyboard, and the More tab's label. Consumer usage lives in -`TabBar.doc.mjs`. +tabs meet the keyboard, and the More tab's label. An app that draws its own +bar gets the same behavior from `useTabBar`, which hands out values and props +and leaves every element to the app. Consumer usage lives in `TabBar.doc.mjs`. ## Compatibility and migration - Released default preserved: `yes` for a bar of five tabs or fewer. A bar of six or more tabs, outside the documented three to five, moves its fifth tab onward into More (FR1). -- Compatibility class: additive; `moreValue` and `TabBarMoreList` are new. +- Compatibility class: additive; `moreValue`, `TabBarMoreList` and `useTabBar` are new. - Controlled/uncontrolled behavior: unchanged; the app owns `value`. - Migration decision: none needed. @@ -60,34 +68,44 @@ tabs meet the keyboard, and the More tab's label. Consumer usage lives in - Which tabs the bar shows, and when More replaces the rest. - When More reads as selected, and what choosing More again means. - `TabBarMoreList`: More's list of the remaining tabs. +- `useTabBar`: the bar's behavior, as values and props, for a bar the app draws. **Does not own / non-goals** - More's navigation stack and the screens inside it — owned by the app. - Rearranging tabs (iOS's Edit) — not provided. +- The look of a bar the app draws, and its lens's motion — owned by the app, which may animate it with `useAnimator` (`spec:AST-107` FR3). +- An action beside the tabs, such as a compose button — the app's own control (FR11). ## Public concepts -| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | -| ---------------- | ----------------------- | --------------------------------------------------------- | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------- | -| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | -| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | -| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | +| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | +| ---------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------------------- | +| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | +| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | +| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | +| `useTabBar` | one result per render | A bar the app draws: the tab list's props, each shown tab's props and state, the tabs past the fourth, and the lens's state | Always | none | `component:TabBar` | experimental | Takes `TabBar`'s props, with `items` in place of children | +| Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | +| Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | ## Behavioral and layout contract Draft requirements identify their basis so observed code is not mistaken for an intentional decision. A `current` contract contains no unresolved rows. -| ID | Candidate invariant | Basis | Draft review state | -| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | ------------------ | -| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | -| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | -| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | -| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | -| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | -| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | -| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | +| ID | Candidate invariant | Basis | Draft review state | +| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------ | +| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | +| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | +| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | +| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | +| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | +| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | +| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | +| FR8 | `useTabBar({value, onChange, onReselect?, onLensMove?, moreValue?, label?, items})` MUST give a bar the app draws the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props. | DEC-1 | proposed | +| FR9 | `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | proposed | +| FR10 | `TabBar` MUST render entirely through `useTabBar`, so the component and a bar built on the hook choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7 | proposed | +| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `useTabBar` gives it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | proposed | ### Allowed variation @@ -95,11 +113,13 @@ intentional decision. A `current` contract contains no unresolved rows. ### Representative states -| State | Required invariant | Allowed variation | -| ------------------------------ | ----------------------------------------------------------- | ----------------- | -| Five tabs | No More tab (FR1) | None | -| Six tabs, a fifth selected | More selected; its list shows the fifth selected (FR2, FR4) | None | -| A disabled tab past the fourth | Its row is disabled (FR5) | Its dimmed paint | +| State | Required invariant | Allowed variation | +| --------------------------------------- | ----------------------------------------------------------- | -------------------------- | +| Five tabs | No More tab (FR1) | None | +| Six tabs, a fifth selected | More selected; its list shows the fifth selected (FR2, FR4) | None | +| A disabled tab past the fourth | Its row is disabled (FR5) | Its dimmed paint | +| A drawn bar, a finger dragging the lens | Lens state `dragging`, over the tab under the finger (FR9) | The lens's look and motion | +| A drawn bar with a compose action | The action is outside the tab list (FR11) | Its place beside the tabs | ### Transformation and precedence order @@ -108,40 +128,60 @@ intentional decision. A `current` contract contains no unresolved rows. ### Performance and resources - **PR1 — no extra listeners.** The More tab adds no listener beyond those of a tab. +- **PR2 — one implementation.** A page that renders `TabBar` carries the hook as part of the component (FR10). A page that uses only `useTabBar` carries no bar styles, capsule or lens drawing (`architecture:component-import-boundaries` INV10). ## Accessibility contract - **AR1 — one name per row.** A More row with a badge MUST be named by `@astryx.tabBar.badgedItem`, as its tab is. - **AR2 — named list.** `TabBarMoreList` MUST be named by `@astryx.tabBar.more`. +- **AR3 — a drawn bar keeps the names.** The props `useTabBar` returns MUST name the tab list and each tab as `TabBar` does, a badged tab by `@astryx.tabBar.badgedItem` (AR1). ## Design relationships | Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract | | ---------------- | ------------------ | ------------------------ | -------------- | ------------------ | | More tab | None recorded | prescribed (UIKit) | supporting | FR1, FR7 | +| A drawn bar | None recorded | the app | supporting | FR8, FR9 | The component implements design requirements without copying their rationale. ## Family and system relationships - `spec:AST-085` owns the disabled-control rules; TabBar applies FR1, FR2 and FR5 to its tabs and their More rows. +- `spec:AST-107` DEC-1 gives products values and props, never gesture machinery; `useTabBar` follows it (FR9). Its FR7 has Core and Lab build on the public layer, so `TabBar` renders through `useTabBar` (FR10), as `component:ContextMenu` renders through `useContextMenu`. - `spec:AST-085` leaves the arrow keys inside a composite to its own record: "Which items arrow keys visit inside a composite widget (listbox, menu, grid, tablist, roving group). The composite's own record decides that." FR6 decides it for TabBar, as Core's TabList does. ## Verification map -| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | -| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------- | ------------- | -| FR1 | "shows the first four tabs and More when there are more than five"; "six tabs: the bar shows the first four and More…" | Five and six tabs | A bar without More shows six tabs and fails both | None | -| FR2 | "selects More for a tab it holds, and chooses More with its value" | A fifth tab selected | Selecting the fifth tab itself fails it | None | -| FR3 | "selects More for a tab it holds, and chooses More with its value"; "More again while it holds a tab is a reselect, back to its list" | More unselected, and More holding a tab | Calling `onChange` with `moreValue` on a reselect, or not on a first choice, fails it | None | -| FR4 | "lists the tabs past the fourth, and a row chooses its tab"; "reads the selected tab’s More row as selected, and no other row"; "a section chosen in More opens inside it…"; "right to left, the More list’s disclosure chevrons point left…" | LTR and RTL, Help selected | A missing row, selected row or unmirrored chevron fails it | None | -| FR5 | "keeps a disabled tab past the fourth disabled in its More row…" | Help disabled | An enabled row fails it | None | -| FR6 | "is skipped by the arrow keys"; "a disabled tab is announced disabled on the tab itself, with its name, in the accessibility tree (spec:AST-085 FR5)" | A disabled second tab | Focus landing on the disabled tab, or a missing disabled state, fails it | None | -| FR7 | "names the More tab and its list with one catalog message, so a translation can change it"; `pnpm check:i18n-catalog`, for the key | The More tab and its list, under an override | A hard-coded label ignores the override and fails it | None | +| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | +| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------- | +| FR1 | "shows the first four tabs and More when there are more than five"; "six tabs: the bar shows the first four and More…" | Five and six tabs | A bar without More shows six tabs and fails both | None | +| FR2 | "selects More for a tab it holds, and chooses More with its value" | A fifth tab selected | Selecting the fifth tab itself fails it | None | +| FR3 | "selects More for a tab it holds, and chooses More with its value"; "More again while it holds a tab is a reselect, back to its list" | More unselected, and More holding a tab | Calling `onChange` with `moreValue` on a reselect, or not on a first choice, fails it | None | +| FR4 | "lists the tabs past the fourth, and a row chooses its tab"; "reads the selected tab’s More row as selected, and no other row"; "a section chosen in More opens inside it…"; "right to left, the More list’s disclosure chevrons point left…" | LTR and RTL, Help selected | A missing row, selected row or unmirrored chevron fails it | None | +| FR5 | "keeps a disabled tab past the fourth disabled in its More row…" | Help disabled | An enabled row fails it | None | +| FR6 | "is skipped by the arrow keys"; "a disabled tab is announced disabled on the tab itself, with its name, in the accessibility tree (spec:AST-085 FR5)" | A disabled second tab | Focus landing on the disabled tab, or a missing disabled state, fails it | None | +| FR7 | "names the More tab and its list with one catalog message, so a translation can change it"; `pnpm check:i18n-catalog`, for the key | The More tab and its list, under an override | A hard-coded label ignores the override and fails it | None | +| FR8, FR9, AR3 | Unit tests of `useTabBar` driving a bar of plain elements | Five and six tabs, a reselect, a disabled tab, a finger lifting, dragging and lifting off the lens | A missing role or name, a reselect that changes the value, or lens states out of order fail them | None | +| FR10 | TabBar's unit and interaction tests, over the component built on the hook | Every state above | A behavior that differs between the component and the hook fails them | None | +| FR11 | A unit test of a drawn bar with a compose button beside the tabs | The arrow keys across the tabs, the action focused | The action inside the tab list, or in the arrow keys' order, fails it | None | ## Decision log -None recorded. +### DEC-1 — An app draws its own bar on `useTabBar` + +**Reference:** `component:TabBar/DEC-1` +**Decider:** pending + +An app with its own look keeps the tab bar's behavior: the selection, the names +and keys, the More overflow, and the finger's lens. `useTabBar` hands these out +as values and props, the layer `spec:AST-107` DEC-1 gives products, and leaves +every element and the lens's drawing to the app (FR8, FR9). `TabBar` renders +entirely through the hook (FR10), so the two are one API, as +`architecture:public-component-api` INV21 counts a component built on a public +factory. + +Rejected: a `renderTab` prop and an action slot on `TabBar`, which keep the bar's capsule and lens look. ## Open questions From c5a239766e5ce5fb82fed503836e432078503bb1 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 15 Nov 2026 22:44:42 -0800 Subject: [PATCH 2/8] docs(TabBar): cite only the public-layer rules for useTabBar The family line no longer names another component as built on its hook; the record cites spec:AST-107 DEC-1 and FR7 alone. --- docs/specs/components/TabBar/TabBar.spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 38887f8cdf88c..67416a2fc5e70 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -148,7 +148,7 @@ The component implements design requirements without copying their rationale. ## Family and system relationships - `spec:AST-085` owns the disabled-control rules; TabBar applies FR1, FR2 and FR5 to its tabs and their More rows. -- `spec:AST-107` DEC-1 gives products values and props, never gesture machinery; `useTabBar` follows it (FR9). Its FR7 has Core and Lab build on the public layer, so `TabBar` renders through `useTabBar` (FR10), as `component:ContextMenu` renders through `useContextMenu`. +- `spec:AST-107` DEC-1 gives products values and props, never gesture machinery; `useTabBar` follows it (FR9). Its FR7 has Core and Lab build on the public layer, so `TabBar` renders through `useTabBar` (FR10). - `spec:AST-085` leaves the arrow keys inside a composite to its own record: "Which items arrow keys visit inside a composite widget (listbox, menu, grid, tablist, roving group). The composite's own record decides that." FR6 decides it for TabBar, as Core's TabList does. ## Verification map From 6868712d364001f1e2bc6a2ab0a41fd2bbb40415 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 15 Nov 2026 23:01:37 -0800 Subject: [PATCH 3/8] docs(TabBar): the bar is not drawn over or above the keyboard FR12: while the on-screen keyboard is up, TabBar is not drawn over or above it, and it returns when the keyboard goes down. It reads whether a keyboard is up through Core's internal keyboard entry. OQ1 asks whether the bar hides, as FR12 reads, or rides above the keys. --- docs/specs/components/TabBar/TabBar.spec.md | 82 ++++++++++++--------- 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 67416a2fc5e70..467a366108842 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -27,6 +27,7 @@ system_specs: spec:AST-085/FR5, spec:AST-107/DEC-1, spec:AST-107/FR7, + spec:AST-099/FR3, ] --- @@ -34,15 +35,15 @@ system_specs: ## Contract at a glance -| Area | Contract | -| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| Public contract | `TabBar` takes `moreValue` (default `'more'`); `TabBarMoreList` takes `children`, `value` and `onChange`; `useTabBar` hands a bar the app draws the same behavior as values and props; Core's catalog has `@astryx.tabBar.more`. | -| Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. A bar drawn on `useTabBar` behaves as `TabBar` does, and an action beside the tabs is never a tab. | -| End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. A bar with an app's own look keeps the tab bar's names, keys and finger lens. | -| Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props and draws the lens from its state. | -| Compatibility/readiness | Five tabs or fewer render as before; `useTabBar` is additive. Draft. | -| Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a hook that returns a gesture recognizer or an animator, and an action inside the tab list. | -| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1 and FR7 (products get values and props, and Lab builds on the same layer). | +| Area | Contract | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Public contract | `TabBar` takes `moreValue` (default `'more'`); `TabBarMoreList` takes `children`, `value` and `onChange`; `useTabBar` hands a bar the app draws the same behavior as values and props; Core's catalog has `@astryx.tabBar.more`. | +| Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. A bar drawn on `useTabBar` behaves as `TabBar` does, and an action beside the tabs is never a tab. While the on-screen keyboard is up, the bar is not drawn over or above it, and it returns when the keyboard goes down (OQ1). | +| End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. A bar with an app's own look keeps the tab bar's names, keys and finger lens. | +| Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props and draws the lens from its state. | +| Compatibility/readiness | Five tabs or fewer render as before; `useTabBar` is additive. Draft. | +| Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a hook that returns a gesture recognizer or an animator, and an action inside the tab list. Reject a bar drawn over or above the on-screen keyboard. | +| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1 and FR7 (products get values and props, and Lab builds on the same layer). `spec:AST-099` FR3 for the keyboard's state. | This table is a review projection; the body below is authoritative. @@ -87,25 +88,27 @@ and leaves every element to the app. Consumer usage lives in `TabBar.doc.mjs`. | `useTabBar` | one result per render | A bar the app draws: the tab list's props, each shown tab's props and state, the tabs past the fourth, and the lens's state | Always | none | `component:TabBar` | experimental | Takes `TabBar`'s props, with `items` in place of children | | Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | | Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | +| Keyboard state | up, down | Whether a software keyboard is up, and its height if OQ1 rules that the bar rides | Always | down | `component:TabBar` | experimental | Not applicable | ## Behavioral and layout contract Draft requirements identify their basis so observed code is not mistaken for an intentional decision. A `current` contract contains no unresolved rows. -| ID | Candidate invariant | Basis | Draft review state | -| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------ | -| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | -| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | -| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | -| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | -| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | -| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | -| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | -| FR8 | `useTabBar({value, onChange, onReselect?, onLensMove?, moreValue?, label?, items})` MUST give a bar the app draws the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props. | DEC-1 | proposed | -| FR9 | `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | proposed | -| FR10 | `TabBar` MUST render entirely through `useTabBar`, so the component and a bar built on the hook choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7 | proposed | -| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `useTabBar` gives it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | proposed | +| ID | Candidate invariant | Basis | Draft review state | +| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | +| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | +| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | +| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | +| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | +| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | +| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | +| FR8 | `useTabBar({value, onChange, onReselect?, onLensMove?, moreValue?, label?, items})` MUST give a bar the app draws the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props. | DEC-1 | proposed | +| FR9 | `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | proposed | +| FR10 | `TabBar` MUST render entirely through `useTabBar`, so the component and a bar built on the hook choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7 | proposed | +| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `useTabBar` gives it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | proposed | +| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. It reads whether a keyboard is up through Core's internal keyboard entry (`spec:AST-099` FR3), in a host that keeps its window and in one that resizes for the keyboard, and `useTabBar` exposes it. | Device captures with a field focused: above the keys in iPhone Safari (behind its address bar) and with `interactive-widget=resizes-content`; covered in Android Chrome's default and an iPhone Home Screen app | open (OQ1) | ### Allowed variation @@ -120,6 +123,7 @@ intentional decision. A `current` contract contains no unresolved rows. | A disabled tab past the fourth | Its row is disabled (FR5) | Its dimmed paint | | A drawn bar, a finger dragging the lens | Lens state `dragging`, over the tab under the finger (FR9) | The lens's look and motion | | A drawn bar with a compose action | The action is outside the tab list (FR11) | Its place beside the tabs | +| A field focused, the keyboard up | The bar is not drawn over or above the keyboard (FR12) | Hide or ride (OQ1) | ### Transformation and precedence order @@ -149,22 +153,24 @@ The component implements design requirements without copying their rationale. - `spec:AST-085` owns the disabled-control rules; TabBar applies FR1, FR2 and FR5 to its tabs and their More rows. - `spec:AST-107` DEC-1 gives products values and props, never gesture machinery; `useTabBar` follows it (FR9). Its FR7 has Core and Lab build on the public layer, so `TabBar` renders through `useTabBar` (FR10). +- `spec:AST-099` FR3 governs the keyboard value Core keeps internal. FR12 reads whether a keyboard is up, in a host that keeps its window and in one that resizes; a bar that rides (OQ1) also needs its height. - `spec:AST-085` leaves the arrow keys inside a composite to its own record: "Which items arrow keys visit inside a composite widget (listbox, menu, grid, tablist, roving group). The composite's own record decides that." FR6 decides it for TabBar, as Core's TabList does. ## Verification map -| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | -| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------- | -| FR1 | "shows the first four tabs and More when there are more than five"; "six tabs: the bar shows the first four and More…" | Five and six tabs | A bar without More shows six tabs and fails both | None | -| FR2 | "selects More for a tab it holds, and chooses More with its value" | A fifth tab selected | Selecting the fifth tab itself fails it | None | -| FR3 | "selects More for a tab it holds, and chooses More with its value"; "More again while it holds a tab is a reselect, back to its list" | More unselected, and More holding a tab | Calling `onChange` with `moreValue` on a reselect, or not on a first choice, fails it | None | -| FR4 | "lists the tabs past the fourth, and a row chooses its tab"; "reads the selected tab’s More row as selected, and no other row"; "a section chosen in More opens inside it…"; "right to left, the More list’s disclosure chevrons point left…" | LTR and RTL, Help selected | A missing row, selected row or unmirrored chevron fails it | None | -| FR5 | "keeps a disabled tab past the fourth disabled in its More row…" | Help disabled | An enabled row fails it | None | -| FR6 | "is skipped by the arrow keys"; "a disabled tab is announced disabled on the tab itself, with its name, in the accessibility tree (spec:AST-085 FR5)" | A disabled second tab | Focus landing on the disabled tab, or a missing disabled state, fails it | None | -| FR7 | "names the More tab and its list with one catalog message, so a translation can change it"; `pnpm check:i18n-catalog`, for the key | The More tab and its list, under an override | A hard-coded label ignores the override and fails it | None | -| FR8, FR9, AR3 | Unit tests of `useTabBar` driving a bar of plain elements | Five and six tabs, a reselect, a disabled tab, a finger lifting, dragging and lifting off the lens | A missing role or name, a reselect that changes the value, or lens states out of order fail them | None | -| FR10 | TabBar's unit and interaction tests, over the component built on the hook | Every state above | A behavior that differs between the component and the hook fails them | None | -| FR11 | A unit test of a drawn bar with a compose button beside the tabs | The arrow keys across the tabs, the action focused | The action inside the tab list, or in the arrow keys' order, fails it | None | +| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | +| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------- | +| FR1 | "shows the first four tabs and More when there are more than five"; "six tabs: the bar shows the first four and More…" | Five and six tabs | A bar without More shows six tabs and fails both | None | +| FR2 | "selects More for a tab it holds, and chooses More with its value" | A fifth tab selected | Selecting the fifth tab itself fails it | None | +| FR3 | "selects More for a tab it holds, and chooses More with its value"; "More again while it holds a tab is a reselect, back to its list" | More unselected, and More holding a tab | Calling `onChange` with `moreValue` on a reselect, or not on a first choice, fails it | None | +| FR4 | "lists the tabs past the fourth, and a row chooses its tab"; "reads the selected tab’s More row as selected, and no other row"; "a section chosen in More opens inside it…"; "right to left, the More list’s disclosure chevrons point left…" | LTR and RTL, Help selected | A missing row, selected row or unmirrored chevron fails it | None | +| FR5 | "keeps a disabled tab past the fourth disabled in its More row…" | Help disabled | An enabled row fails it | None | +| FR6 | "is skipped by the arrow keys"; "a disabled tab is announced disabled on the tab itself, with its name, in the accessibility tree (spec:AST-085 FR5)" | A disabled second tab | Focus landing on the disabled tab, or a missing disabled state, fails it | None | +| FR7 | "names the More tab and its list with one catalog message, so a translation can change it"; `pnpm check:i18n-catalog`, for the key | The More tab and its list, under an override | A hard-coded label ignores the override and fails it | None | +| FR8, FR9, AR3 | Unit tests of `useTabBar` driving a bar of plain elements | Five and six tabs, a reselect, a disabled tab, a finger lifting, dragging and lifting off the lens | A missing role or name, a reselect that changes the value, or lens states out of order fail them | None | +| FR10 | TabBar's unit and interaction tests, over the component built on the hook | Every state above | A behavior that differs between the component and the hook fails them | None | +| FR11 | A unit test of a drawn bar with a compose button beside the tabs | The arrow keys across the tabs, the action focused | The action inside the tab list, or in the arrow keys' order, fails it | None | +| FR12 | Device captures of the bar with a field focused, in each host | Android Chrome by default and with `interactive-widget=resizes-content`, iPhone Safari with its address bar expanded and collapsed, an iPhone Home Screen app; at rest and after a scroll | A bar drawn over or above the keyboard, or one that does not return, fails it | None | ## Decision log @@ -185,7 +191,13 @@ Rejected: a `renderTab` prop and an action slot on `TabBar`, which keep the bar' ## Open questions -None. +- **OQ1 — Hide or ride.** While the keyboard is up, FR12 keeps the bar from being + drawn over or above it, so the bar hides. Should it instead ride fully above + the keys? Hiding matches UIKit, where no part of the tab bar shows over the + keyboard, and needs only whether a keyboard is up. Riding keeps the sections + in reach while typing, and needs the keyboard's height to place the bar, + except where the window shrinks. Both read the keyboard through + `spec:AST-099` FR3. ## Content boundary From 65d15518778b020203efa7c1e3beef2c7edb9bd1 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 15 Nov 2026 23:09:15 -0800 Subject: [PATCH 4/8] docs(TabBar): draft states and requirement gaps FR8 to FR12 wait for a human decision, and the record names their gaps: no useTabBar exists, and TabBar reads no keyboard state. --- docs/specs/components/TabBar/TabBar.spec.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 467a366108842..8baf29b0dbd2b 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -41,7 +41,7 @@ system_specs: | Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. A bar drawn on `useTabBar` behaves as `TabBar` does, and an action beside the tabs is never a tab. While the on-screen keyboard is up, the bar is not drawn over or above it, and it returns when the keyboard goes down (OQ1). | | End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. A bar with an app's own look keeps the tab bar's names, keys and finger lens. | | Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props and draws the lens from its state. | -| Compatibility/readiness | Five tabs or fewer render as before; `useTabBar` is additive. Draft. | +| Compatibility/readiness | Five tabs or fewer render as before; `useTabBar` is additive. Draft. Requirement gaps: FR8–FR12. | | Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a hook that returns a gesture recognizer or an animator, and an action inside the tab list. Reject a bar drawn over or above the on-screen keyboard. | | Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1 and FR7 (products get values and props, and Lab builds on the same layer). `spec:AST-099` FR3 for the keyboard's state. | @@ -104,11 +104,14 @@ intentional decision. A `current` contract contains no unresolved rows. | FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | | FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | | FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | -| FR8 | `useTabBar({value, onChange, onReselect?, onLensMove?, moreValue?, label?, items})` MUST give a bar the app draws the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props. | DEC-1 | proposed | -| FR9 | `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | proposed | -| FR10 | `TabBar` MUST render entirely through `useTabBar`, so the component and a bar built on the hook choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7 | proposed | -| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `useTabBar` gives it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | proposed | -| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. It reads whether a keyboard is up through Core's internal keyboard entry (`spec:AST-099` FR3), in a host that keeps its window and in one that resizes for the keyboard, and `useTabBar` exposes it. | Device captures with a field focused: above the keys in iPhone Safari (behind its address bar) and with `interactive-widget=resizes-content`; covered in Android Chrome's default and an iPhone Home Screen app | open (OQ1) | +| FR8 | `useTabBar({value, onChange, onReselect?, onLensMove?, moreValue?, label?, items})` MUST give a bar the app draws the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props. | DEC-1 | human decision | +| FR9 | `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | human decision | +| FR10 | `TabBar` MUST render entirely through `useTabBar`, so the component and a bar built on the hook choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7 | human decision | +| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `useTabBar` gives it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | human decision | +| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. It reads whether a keyboard is up through Core's internal keyboard entry (`spec:AST-099` FR3), in a host that keeps its window and in one that resizes for the keyboard, and `useTabBar` exposes it. | Device captures with a field focused: above the keys in iPhone Safari (behind its address bar) and with `interactive-widget=resizes-content`; covered in Android Chrome's default and an iPhone Home Screen app | human decision | + +- FR8–FR11 gap: no `useTabBar` exists, and `TabBar` renders its own elements. +- FR12 gap: TabBar reads no keyboard state. With a field focused, the bar shows above the keys in iPhone Safari and where the window shrinks for the keyboard, and partly after a scroll in Android Chrome. ### Allowed variation From 1ecec23bda5399d967113868e3b40039f1787d3d Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 15 Nov 2026 23:19:57 -0800 Subject: [PATCH 5/8] docs(TabBar): a createTabBar factory under useTabBar As gesture hooks sit on factories, createTabBar gives the bar's behavior without React, useTabBar delegates to it, and TabBar is built on it, so INV21 and INV22 apply as written. FR12's basis says the bar shows above the keys once the page pans, and at once where the window resizes. --- docs/specs/components/TabBar/TabBar.spec.md | 130 ++++++++++---------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 8baf29b0dbd2b..93fed3f585b9c 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -35,15 +35,15 @@ system_specs: ## Contract at a glance -| Area | Contract | -| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Public contract | `TabBar` takes `moreValue` (default `'more'`); `TabBarMoreList` takes `children`, `value` and `onChange`; `useTabBar` hands a bar the app draws the same behavior as values and props; Core's catalog has `@astryx.tabBar.more`. | -| Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. A bar drawn on `useTabBar` behaves as `TabBar` does, and an action beside the tabs is never a tab. While the on-screen keyboard is up, the bar is not drawn over or above it, and it returns when the keyboard goes down (OQ1). | -| End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. A bar with an app's own look keeps the tab bar's names, keys and finger lens. | -| Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props and draws the lens from its state. | -| Compatibility/readiness | Five tabs or fewer render as before; `useTabBar` is additive. Draft. Requirement gaps: FR8–FR12. | -| Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a hook that returns a gesture recognizer or an animator, and an action inside the tab list. Reject a bar drawn over or above the on-screen keyboard. | -| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1 and FR7 (products get values and props, and Lab builds on the same layer). `spec:AST-099` FR3 for the keyboard's state. | +| Area | Contract | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Public contract | `TabBar` takes `moreValue` (default `'more'`); `TabBarMoreList` takes `children`, `value` and `onChange`; `createTabBar`, and `useTabBar` over it, hand a bar the app draws the same behavior as values and props; Core's catalog has `@astryx.tabBar.more`. | +| Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. A bar drawn on `createTabBar` or `useTabBar` behaves as `TabBar` does, and an action beside the tabs is never a tab. While the on-screen keyboard is up, the bar is not drawn over or above it, and it returns when the keyboard goes down (OQ1). | +| End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. A bar with an app's own look keeps the tab bar's names, keys and finger lens. | +| Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props, or `createTabBar`'s values without React, and draws the lens from its state. | +| Compatibility/readiness | Five tabs or fewer render as before; `createTabBar` and `useTabBar` are additive. Draft. Requirement gaps: FR8–FR12. | +| Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a factory or hook that returns a gesture recognizer or an animator, or a hook with behavior of its own. Reject an action inside the tab list. Reject a bar drawn over or above the on-screen keyboard. | +| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1, DEC-2 and FR7 (products get values and props from a factory and its hook, and Lab builds on the same layer); `architecture:public-component-api` INV21 and INV22. `spec:AST-099` FR3 for the keyboard's state. | This table is a review projection; the body below is authoritative. @@ -52,13 +52,14 @@ This table is a review projection; the body below is authoritative. TabBar is the lab's floating bar of top-level sections, modelled on UIKit's tab bar. This record states how it holds more sections than fit, how disabled tabs meet the keyboard, and the More tab's label. An app that draws its own -bar gets the same behavior from `useTabBar`, which hands out values and props -and leaves every element to the app. Consumer usage lives in `TabBar.doc.mjs`. +bar gets the same behavior from `createTabBar`, a factory that works without +React, or from `useTabBar`, its thin hook. They hand out values and props and +leave every element to the app. Consumer usage lives in `TabBar.doc.mjs`. ## Compatibility and migration - Released default preserved: `yes` for a bar of five tabs or fewer. A bar of six or more tabs, outside the documented three to five, moves its fifth tab onward into More (FR1). -- Compatibility class: additive; `moreValue`, `TabBarMoreList` and `useTabBar` are new. +- Compatibility class: additive; `moreValue`, `TabBarMoreList`, `createTabBar` and `useTabBar` are new. - Controlled/uncontrolled behavior: unchanged; the app owns `value`. - Migration decision: none needed. @@ -69,7 +70,7 @@ and leaves every element to the app. Consumer usage lives in `TabBar.doc.mjs`. - Which tabs the bar shows, and when More replaces the rest. - When More reads as selected, and what choosing More again means. - `TabBarMoreList`: More's list of the remaining tabs. -- `useTabBar`: the bar's behavior, as values and props, for a bar the app draws. +- `createTabBar` and `useTabBar`: the bar's behavior, as values and props, for a bar the app draws. **Does not own / non-goals** @@ -80,38 +81,39 @@ and leaves every element to the app. Consumer usage lives in `TabBar.doc.mjs`. ## Public concepts -| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | -| ---------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------------------- | -| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | -| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | -| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | -| `useTabBar` | one result per render | A bar the app draws: the tab list's props, each shown tab's props and state, the tabs past the fourth, and the lens's state | Always | none | `component:TabBar` | experimental | Takes `TabBar`'s props, with `items` in place of children | -| Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | -| Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | -| Keyboard state | up, down | Whether a software keyboard is up, and its height if OQ1 rules that the bar rides | Always | down | `component:TabBar` | experimental | Not applicable | +| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | +| ---------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------------------- | +| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | +| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | +| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | +| `createTabBar` | `{update, destroy}` | Attaches the bar's behavior to the tab list the app renders, without React, and reports its state: the shown tabs, the selection, the tabs past the fourth, and the lens | Always | none | `component:TabBar` | experimental | Takes `TabBar`'s props, with `items` in place of children | +| `useTabBar` | one result per render | `createTabBar`'s thin React wrapper: the tab list's props, each shown tab's props and state, the tabs past the fourth, and the lens's state | Always | none | `component:TabBar` | experimental | As `createTabBar` | +| Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | +| Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | +| Keyboard state | up, down | Whether a software keyboard is up, and its height if OQ1 rules that the bar rides | Always | down | `component:TabBar` | experimental | Not applicable | ## Behavioral and layout contract Draft requirements identify their basis so observed code is not mistaken for an intentional decision. A `current` contract contains no unresolved rows. -| ID | Candidate invariant | Basis | Draft review state | -| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | -| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | -| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | -| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | -| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | -| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | -| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | -| FR8 | `useTabBar({value, onChange, onReselect?, onLensMove?, moreValue?, label?, items})` MUST give a bar the app draws the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props. | DEC-1 | human decision | -| FR9 | `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | human decision | -| FR10 | `TabBar` MUST render entirely through `useTabBar`, so the component and a bar built on the hook choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7 | human decision | -| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `useTabBar` gives it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | human decision | -| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. It reads whether a keyboard is up through Core's internal keyboard entry (`spec:AST-099` FR3), in a host that keeps its window and in one that resizes for the keyboard, and `useTabBar` exposes it. | Device captures with a field focused: above the keys in iPhone Safari (behind its address bar) and with `interactive-widget=resizes-content`; covered in Android Chrome's default and an iPhone Home Screen app | human decision | - -- FR8–FR11 gap: no `useTabBar` exists, and `TabBar` renders its own elements. -- FR12 gap: TabBar reads no keyboard state. With a field focused, the bar shows above the keys in iPhone Safari and where the window shrinks for the keyboard, and partly after a scroll in Android Chrome. +| ID | Candidate invariant | Basis | Draft review state | +| ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | +| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | +| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | +| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | +| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | +| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | +| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | +| FR8 | `createTabBar(element, {value, onChange, onReselect?, onLensMove?, moreValue?, label?, items}) → {update(options), destroy()}` MUST give `element`, the tab list the app renders, and its tabs the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props, and `destroy()` removes every listener it added. `useTabBar(options)` is its thin React wrapper, with no behavior of its own. | DEC-1; `spec:AST-107` DEC-2 | human decision | +| FR9 | `createTabBar` and `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | human decision | +| FR10 | `TabBar` MUST be built entirely on `createTabBar`, through `useTabBar`, so the component and a bar built on either choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7; `architecture:public-component-api` INV21 | human decision | +| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `createTabBar` and `useTabBar` give it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | human decision | +| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. It reads whether a keyboard is up through Core's internal keyboard entry (`spec:AST-099` FR3), in a host that keeps its window and in one that resizes for the keyboard, and `createTabBar` and `useTabBar` expose it. | Device captures with a field focused: above the keys at once where the window resizes (`interactive-widget=resizes-content`); in iPhone Safari a sliver under its address bar, and the whole bar once a scroll completes the pan; in an iPhone Home Screen app behind the keyboard's accessory bar; in Android Chrome covered, and partly shown after a scroll | human decision | + +- FR8–FR11 gap: no `createTabBar` or `useTabBar` exists, and `TabBar` renders its own elements. +- FR12 gap: TabBar reads no keyboard state. With a field focused, the bar shows above the keys where the window shrinks for the keyboard, and in iPhone Safari once a scroll completes the pan. In Android Chrome it shows partly after a scroll. ### Allowed variation @@ -135,13 +137,13 @@ intentional decision. A `current` contract contains no unresolved rows. ### Performance and resources - **PR1 — no extra listeners.** The More tab adds no listener beyond those of a tab. -- **PR2 — one implementation.** A page that renders `TabBar` carries the hook as part of the component (FR10). A page that uses only `useTabBar` carries no bar styles, capsule or lens drawing (`architecture:component-import-boundaries` INV10). +- **PR2 — one implementation.** A page that renders `TabBar` carries the factory and the hook as part of the component (FR10). A page that uses only `createTabBar` or `useTabBar` carries no bar styles, capsule or lens drawing (`architecture:component-import-boundaries` INV10). ## Accessibility contract - **AR1 — one name per row.** A More row with a badge MUST be named by `@astryx.tabBar.badgedItem`, as its tab is. - **AR2 — named list.** `TabBarMoreList` MUST be named by `@astryx.tabBar.more`. -- **AR3 — a drawn bar keeps the names.** The props `useTabBar` returns MUST name the tab list and each tab as `TabBar` does, a badged tab by `@astryx.tabBar.badgedItem` (AR1). +- **AR3 — a drawn bar keeps the names.** The props `useTabBar` returns, and the attributes `createTabBar` sets, MUST name the tab list and each tab as `TabBar` does, a badged tab by `@astryx.tabBar.badgedItem` (AR1). ## Design relationships @@ -155,42 +157,42 @@ The component implements design requirements without copying their rationale. ## Family and system relationships - `spec:AST-085` owns the disabled-control rules; TabBar applies FR1, FR2 and FR5 to its tabs and their More rows. -- `spec:AST-107` DEC-1 gives products values and props, never gesture machinery; `useTabBar` follows it (FR9). Its FR7 has Core and Lab build on the public layer, so `TabBar` renders through `useTabBar` (FR10). +- `spec:AST-107` DEC-1 gives products values and props, never gesture machinery, and DEC-2 puts a factory under each hook; `createTabBar` and `useTabBar` follow both (FR8, FR9). Its FR7 has Core and Lab build on the public layer, so `TabBar` is built on `createTabBar` (FR10). `architecture:public-component-api` INV21 counts the three as one API, and INV22's non-React equivalent is the factory. - `spec:AST-099` FR3 governs the keyboard value Core keeps internal. FR12 reads whether a keyboard is up, in a host that keeps its window and in one that resizes; a bar that rides (OQ1) also needs its height. - `spec:AST-085` leaves the arrow keys inside a composite to its own record: "Which items arrow keys visit inside a composite widget (listbox, menu, grid, tablist, roving group). The composite's own record decides that." FR6 decides it for TabBar, as Core's TabList does. ## Verification map -| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | -| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------- | -| FR1 | "shows the first four tabs and More when there are more than five"; "six tabs: the bar shows the first four and More…" | Five and six tabs | A bar without More shows six tabs and fails both | None | -| FR2 | "selects More for a tab it holds, and chooses More with its value" | A fifth tab selected | Selecting the fifth tab itself fails it | None | -| FR3 | "selects More for a tab it holds, and chooses More with its value"; "More again while it holds a tab is a reselect, back to its list" | More unselected, and More holding a tab | Calling `onChange` with `moreValue` on a reselect, or not on a first choice, fails it | None | -| FR4 | "lists the tabs past the fourth, and a row chooses its tab"; "reads the selected tab’s More row as selected, and no other row"; "a section chosen in More opens inside it…"; "right to left, the More list’s disclosure chevrons point left…" | LTR and RTL, Help selected | A missing row, selected row or unmirrored chevron fails it | None | -| FR5 | "keeps a disabled tab past the fourth disabled in its More row…" | Help disabled | An enabled row fails it | None | -| FR6 | "is skipped by the arrow keys"; "a disabled tab is announced disabled on the tab itself, with its name, in the accessibility tree (spec:AST-085 FR5)" | A disabled second tab | Focus landing on the disabled tab, or a missing disabled state, fails it | None | -| FR7 | "names the More tab and its list with one catalog message, so a translation can change it"; `pnpm check:i18n-catalog`, for the key | The More tab and its list, under an override | A hard-coded label ignores the override and fails it | None | -| FR8, FR9, AR3 | Unit tests of `useTabBar` driving a bar of plain elements | Five and six tabs, a reselect, a disabled tab, a finger lifting, dragging and lifting off the lens | A missing role or name, a reselect that changes the value, or lens states out of order fail them | None | -| FR10 | TabBar's unit and interaction tests, over the component built on the hook | Every state above | A behavior that differs between the component and the hook fails them | None | -| FR11 | A unit test of a drawn bar with a compose button beside the tabs | The arrow keys across the tabs, the action focused | The action inside the tab list, or in the arrow keys' order, fails it | None | -| FR12 | Device captures of the bar with a field focused, in each host | Android Chrome by default and with `interactive-widget=resizes-content`, iPhone Safari with its address bar expanded and collapsed, an iPhone Home Screen app; at rest and after a scroll | A bar drawn over or above the keyboard, or one that does not return, fails it | None | +| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | +| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------- | +| FR1 | "shows the first four tabs and More when there are more than five"; "six tabs: the bar shows the first four and More…" | Five and six tabs | A bar without More shows six tabs and fails both | None | +| FR2 | "selects More for a tab it holds, and chooses More with its value" | A fifth tab selected | Selecting the fifth tab itself fails it | None | +| FR3 | "selects More for a tab it holds, and chooses More with its value"; "More again while it holds a tab is a reselect, back to its list" | More unselected, and More holding a tab | Calling `onChange` with `moreValue` on a reselect, or not on a first choice, fails it | None | +| FR4 | "lists the tabs past the fourth, and a row chooses its tab"; "reads the selected tab’s More row as selected, and no other row"; "a section chosen in More opens inside it…"; "right to left, the More list’s disclosure chevrons point left…" | LTR and RTL, Help selected | A missing row, selected row or unmirrored chevron fails it | None | +| FR5 | "keeps a disabled tab past the fourth disabled in its More row…" | Help disabled | An enabled row fails it | None | +| FR6 | "is skipped by the arrow keys"; "a disabled tab is announced disabled on the tab itself, with its name, in the accessibility tree (spec:AST-085 FR5)" | A disabled second tab | Focus landing on the disabled tab, or a missing disabled state, fails it | None | +| FR7 | "names the More tab and its list with one catalog message, so a translation can change it"; `pnpm check:i18n-catalog`, for the key | The More tab and its list, under an override | A hard-coded label ignores the override and fails it | None | +| FR8, FR9, AR3 | Unit tests of `createTabBar` without React and of `useTabBar`, each driving a bar of plain elements; listener counts after `destroy` | Five and six tabs, a reselect, a disabled tab, a finger lifting, dragging and lifting off the lens | A missing role or name, a reselect that changes the value, lens states out of order, or a listener left after `destroy` fail them | None | +| FR10 | TabBar's unit and interaction tests, over the component built on the factory | Every state above | A behavior that differs between the component and the hook fails them | None | +| FR11 | A unit test of a drawn bar with a compose button beside the tabs | The arrow keys across the tabs, the action focused | The action inside the tab list, or in the arrow keys' order, fails it | None | +| FR12 | Device captures of the bar with a field focused, in each host | Android Chrome by default and with `interactive-widget=resizes-content`, iPhone Safari with its address bar expanded and collapsed, an iPhone Home Screen app; an unclaimed and a claimed field; at rest and after a scroll | A bar drawn over or above the keyboard, or one that does not return, fails it | None | ## Decision log -### DEC-1 — An app draws its own bar on `useTabBar` +### DEC-1 — An app draws its own bar on `createTabBar` or `useTabBar` **Reference:** `component:TabBar/DEC-1` **Decider:** pending An app with its own look keeps the tab bar's behavior: the selection, the names -and keys, the More overflow, and the finger's lens. `useTabBar` hands these out -as values and props, the layer `spec:AST-107` DEC-1 gives products, and leaves -every element and the lens's drawing to the app (FR8, FR9). `TabBar` renders -entirely through the hook (FR10), so the two are one API, as -`architecture:public-component-api` INV21 counts a component built on a public -factory. - -Rejected: a `renderTab` prop and an action slot on `TabBar`, which keep the bar's capsule and lens look. +and keys, the More overflow, and the finger's lens. `createTabBar` hands these +out as values without React, and `useTabBar` is its thin hook, the layer and the +shape `spec:AST-107` DEC-1 and DEC-2 give gestures (FR8, FR9). Every element and +the lens's drawing stay the app's. `TabBar` is built entirely on the factory +(FR10), so `architecture:public-component-api` INV21 counts the three as one +API, and INV22's non-React equivalent exists. + +Rejected: a `renderTab` prop and an action slot on `TabBar`, which keep the bar's capsule and lens look; a hook without a factory (INV22). ## Open questions From 2fc03034678b93e3a8970889b962d8c4fbdca531 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Mon, 16 Nov 2026 00:16:09 -0800 Subject: [PATCH 6/8] docs(TabBar): createTabBar reports state and takes labels createTabBar reports the hook's state through getState() and onStateChange, and takes labels for the names it sets. FR12 states the outcome and exposes whether a keyboard is up, never its height; OQ2 asks how Lab reads the keyboard. The focused-field state row allows no variation, and citations claim only what their clauses state. --- docs/specs/components/TabBar/TabBar.spec.md | 74 +++++++++++---------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 93fed3f585b9c..74f5cdb6ae835 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -26,7 +26,7 @@ system_specs: spec:AST-085/FR2, spec:AST-085/FR5, spec:AST-107/DEC-1, - spec:AST-107/FR7, + spec:AST-107/DEC-2, spec:AST-099/FR3, ] --- @@ -43,7 +43,7 @@ system_specs: | Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props, or `createTabBar`'s values without React, and draws the lens from its state. | | Compatibility/readiness | Five tabs or fewer render as before; `createTabBar` and `useTabBar` are additive. Draft. Requirement gaps: FR8–FR12. | | Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a factory or hook that returns a gesture recognizer or an animator, or a hook with behavior of its own. Reject an action inside the tab list. Reject a bar drawn over or above the on-screen keyboard. | -| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1, DEC-2 and FR7 (products get values and props from a factory and its hook, and Lab builds on the same layer); `architecture:public-component-api` INV21 and INV22. `spec:AST-099` FR3 for the keyboard's state. | +| Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1 and DEC-2, the shape followed (gesture hooks give products values and one method each, each over a factory); `architecture:public-component-api` INV21 and INV22; `architecture:internationalization` INV3a. `spec:AST-099` FR3 for the keyboard's state. | This table is a review projection; the body below is authoritative. @@ -81,38 +81,38 @@ leave every element to the app. Consumer usage lives in `TabBar.doc.mjs`. ## Public concepts -| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | -| ---------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------------------- | -| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | -| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | -| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | -| `createTabBar` | `{update, destroy}` | Attaches the bar's behavior to the tab list the app renders, without React, and reports its state: the shown tabs, the selection, the tabs past the fourth, and the lens | Always | none | `component:TabBar` | experimental | Takes `TabBar`'s props, with `items` in place of children | -| `useTabBar` | one result per render | `createTabBar`'s thin React wrapper: the tab list's props, each shown tab's props and state, the tabs past the fourth, and the lens's state | Always | none | `component:TabBar` | experimental | As `createTabBar` | -| Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | -| Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | -| Keyboard state | up, down | Whether a software keyboard is up, and its height if OQ1 rules that the bar rides | Always | down | `component:TabBar` | experimental | Not applicable | +| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | +| ---------------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------- | +| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | +| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | +| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | +| `createTabBar` | `{getState, update, destroy}` | Attaches the bar's behavior to the tab list the app renders, without React, and reports its state through `getState()` and `onStateChange`: the shown tabs, the selection, the tabs past the fourth, and the lens | Always | none | `component:TabBar` | experimental | FR8's options | +| `useTabBar` | one result per render | `createTabBar`'s thin React wrapper: the tab list's props, each shown tab's props and state, the tabs past the fourth, and the lens's state | Always | none | `component:TabBar` | experimental | As `createTabBar` | +| Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | +| Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | +| Keyboard state | up, down | Whether a software keyboard is up, and its height if OQ1 rules that the bar rides | Always | down | `component:TabBar` | experimental | Not applicable | ## Behavioral and layout contract Draft requirements identify their basis so observed code is not mistaken for an intentional decision. A `current` contract contains no unresolved rows. -| ID | Candidate invariant | Basis | Draft review state | -| ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | -| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | -| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | -| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | -| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | -| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | -| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | -| FR8 | `createTabBar(element, {value, onChange, onReselect?, onLensMove?, moreValue?, label?, items}) → {update(options), destroy()}` MUST give `element`, the tab list the app renders, and its tabs the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props, and `destroy()` removes every listener it added. `useTabBar(options)` is its thin React wrapper, with no behavior of its own. | DEC-1; `spec:AST-107` DEC-2 | human decision | -| FR9 | `createTabBar` and `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports its position along the bar while it drags, as `usePanGesture` reports a drag (`spec:AST-107` FR1). | `spec:AST-107` DEC-1 | human decision | -| FR10 | `TabBar` MUST be built entirely on `createTabBar`, through `useTabBar`, so the component and a bar built on either choose, reselect, rove and move the lens alike. | DEC-1; `spec:AST-107` FR7; `architecture:public-component-api` INV21 | human decision | -| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `createTabBar` and `useTabBar` give it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | human decision | -| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. It reads whether a keyboard is up through Core's internal keyboard entry (`spec:AST-099` FR3), in a host that keeps its window and in one that resizes for the keyboard, and `createTabBar` and `useTabBar` expose it. | Device captures with a field focused: above the keys at once where the window resizes (`interactive-widget=resizes-content`); in iPhone Safari a sliver under its address bar, and the whole bar once a scroll completes the pan; in an iPhone Home Screen app behind the keyboard's accessory bar; in Android Chrome covered, and partly shown after a scroll | human decision | - -- FR8–FR11 gap: no `createTabBar` or `useTabBar` exists, and `TabBar` renders its own elements. +| ID | Candidate invariant | Basis | Draft review state | +| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | +| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | +| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | +| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | +| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | +| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | +| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | +| FR8 | `createTabBar(element, {value, onChange, onReselect?, onLensMove?, onStateChange?, moreValue?, label?, labels?, items}) → {getState(), update(options), destroy()}` MUST give `element`, the tab list the app renders, and its tabs the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props, and `destroy()` removes every listener it added. `getState()` returns, and `onStateChange` reports, what `useTabBar` returns: the shown tabs, the selection, the tabs past the fourth, and the lens's state (FR9). `labels` (`{more?, badgedItem?}`) gives each name it sets; an absent key falls back to Core's catalog message. `useTabBar(options)` is its thin React wrapper, with no behavior of its own. | DEC-1; `spec:AST-107` DEC-2; `architecture:internationalization` INV3a | human decision | +| FR9 | `createTabBar` and `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports the lens's center while it drags, in CSS pixels from the tab list's inline-start edge toward its inline end. | `spec:AST-107` DEC-1 | human decision | +| FR10 | `TabBar` MUST be built entirely on `createTabBar`, through `useTabBar`, so the component and a bar built on either choose, reselect, rove and move the lens alike. | DEC-1; `architecture:public-component-api` INV21 | human decision | +| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `createTabBar` and `useTabBar` give it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | human decision | +| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. `createTabBar` and `useTabBar` expose whether a keyboard is up, never its height (`spec:AST-099` FR3). How Lab reads the keyboard is OQ2. | Device captures with a field focused: above the keys at once where the window resizes (`interactive-widget=resizes-content`); in iPhone Safari a sliver under its address bar, and the whole bar once a scroll completes the pan; in an iPhone Home Screen app behind the keyboard's accessory bar; in Android Chrome covered, and partly shown after a scroll | human decision | + +- FR8–FR11 gap: `TabBar` renders its own elements, so a bar an app draws gets none of its behavior. - FR12 gap: TabBar reads no keyboard state. With a field focused, the bar shows above the keys where the window shrinks for the keyboard, and in iPhone Safari once a scroll completes the pan. In Android Chrome it shows partly after a scroll. ### Allowed variation @@ -128,7 +128,7 @@ intentional decision. A `current` contract contains no unresolved rows. | A disabled tab past the fourth | Its row is disabled (FR5) | Its dimmed paint | | A drawn bar, a finger dragging the lens | Lens state `dragging`, over the tab under the finger (FR9) | The lens's look and motion | | A drawn bar with a compose action | The action is outside the tab list (FR11) | Its place beside the tabs | -| A field focused, the keyboard up | The bar is not drawn over or above the keyboard (FR12) | Hide or ride (OQ1) | +| A field focused, the keyboard up | The bar is not drawn over or above the keyboard (FR12) | None | ### Transformation and precedence order @@ -137,13 +137,13 @@ intentional decision. A `current` contract contains no unresolved rows. ### Performance and resources - **PR1 — no extra listeners.** The More tab adds no listener beyond those of a tab. -- **PR2 — one implementation.** A page that renders `TabBar` carries the factory and the hook as part of the component (FR10). A page that uses only `createTabBar` or `useTabBar` carries no bar styles, capsule or lens drawing (`architecture:component-import-boundaries` INV10). +- **PR2 — one implementation.** A page that renders `TabBar` carries the factory and the hook as part of the component (FR10). A page that uses only `createTabBar` or `useTabBar` carries no bar styles, capsule or lens drawing. ## Accessibility contract - **AR1 — one name per row.** A More row with a badge MUST be named by `@astryx.tabBar.badgedItem`, as its tab is. - **AR2 — named list.** `TabBarMoreList` MUST be named by `@astryx.tabBar.more`. -- **AR3 — a drawn bar keeps the names.** The props `useTabBar` returns, and the attributes `createTabBar` sets, MUST name the tab list and each tab as `TabBar` does, a badged tab by `@astryx.tabBar.badgedItem` (AR1). +- **AR3 — a drawn bar keeps the names.** The props `useTabBar` returns, and the attributes `createTabBar` sets, MUST name the tab list and each tab as `TabBar` does, a badged tab by `@astryx.tabBar.badgedItem` (AR1) or by the factory's `labels`. ## Design relationships @@ -157,7 +157,7 @@ The component implements design requirements without copying their rationale. ## Family and system relationships - `spec:AST-085` owns the disabled-control rules; TabBar applies FR1, FR2 and FR5 to its tabs and their More rows. -- `spec:AST-107` DEC-1 gives products values and props, never gesture machinery, and DEC-2 puts a factory under each hook; `createTabBar` and `useTabBar` follow both (FR8, FR9). Its FR7 has Core and Lab build on the public layer, so `TabBar` is built on `createTabBar` (FR10). `architecture:public-component-api` INV21 counts the three as one API, and INV22's non-React equivalent is the factory. +- `spec:AST-107` DEC-1 gives products values and one method each from its gesture hooks, never the gesture machinery, and DEC-2 puts a factory under each hook. `createTabBar` and `useTabBar` follow that shape (FR8, FR9). `TabBar` is built on `createTabBar` (FR10), so `architecture:public-component-api` INV21 counts the three as one API, and INV22's non-React equivalent is the factory. - `spec:AST-099` FR3 governs the keyboard value Core keeps internal. FR12 reads whether a keyboard is up, in a host that keeps its window and in one that resizes; a bar that rides (OQ1) also needs its height. - `spec:AST-085` leaves the arrow keys inside a composite to its own record: "Which items arrow keys visit inside a composite widget (listbox, menu, grid, tablist, roving group). The composite's own record decides that." FR6 decides it for TabBar, as Core's TabList does. @@ -201,8 +201,14 @@ Rejected: a `renderTab` prop and an action slot on `TabBar`, which keep the bar' the keys? Hiding matches UIKit, where no part of the tab bar shows over the keyboard, and needs only whether a keyboard is up. Riding keeps the sections in reach while typing, and needs the keyboard's height to place the bar, - except where the window shrinks. Both read the keyboard through - `spec:AST-099` FR3. + except where the window shrinks. Both need OQ2's keyboard read; riding also + needs the height, which `spec:AST-099` FR3 keeps internal. +- **OQ2 — Lab's keyboard read.** FR12 needs Lab to know a keyboard is up, in a + host that keeps its window and in one that resizes for the keyboard. + `architecture:react-component-runtime` INV11 keeps Core's keyboard measure + unexported, and `spec:AST-099` FR2's height is 0 where the window resizes. + Should `spec:AST-099` give Lab whether a keyboard is up, with a signal where + the window resizes? Without that read, FR12 has no detection. ## Content boundary From bf7fe34f2a806ddb64dcb96b56f8617c614f9e90 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Mon, 16 Nov 2026 00:52:07 -0800 Subject: [PATCH 7/8] docs(TabBar): the factory's state says whether a keyboard is up FR8's state and both concept rows carry whether a keyboard is up, as FR12 exposes it, and a unit-test row covers it. The record lists the architecture records it cites. --- docs/specs/components/TabBar/TabBar.spec.md | 56 ++++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 74f5cdb6ae835..7501ce007eb40 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -18,7 +18,12 @@ verified_by: modules: [] families: [] design_specs: [] -architecture: [] +architecture: + [ + architecture:public-component-api, + architecture:internationalization, + architecture:react-component-runtime, + ] contributing: [] system_specs: [ @@ -81,36 +86,36 @@ leave every element to the app. Consumer usage lives in `TabBar.doc.mjs`. ## Public concepts -| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | -| ---------------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------- | -| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | -| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | -| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | -| `createTabBar` | `{getState, update, destroy}` | Attaches the bar's behavior to the tab list the app renders, without React, and reports its state through `getState()` and `onStateChange`: the shown tabs, the selection, the tabs past the fourth, and the lens | Always | none | `component:TabBar` | experimental | FR8's options | -| `useTabBar` | one result per render | `createTabBar`'s thin React wrapper: the tab list's props, each shown tab's props and state, the tabs past the fourth, and the lens's state | Always | none | `component:TabBar` | experimental | As `createTabBar` | -| Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | -| Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | -| Keyboard state | up, down | Whether a software keyboard is up, and its height if OQ1 rules that the bar rides | Always | down | `component:TabBar` | experimental | Not applicable | +| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | +| ---------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------- | ------------------ | ------------ | --------------------------------------------- | +| More tab | shown, hidden | The fifth slot, standing for every tab past the fourth | Shown only past five tabs | hidden | `component:TabBar` | experimental | Not applicable | +| `moreValue` | any string | The value the app's `value` takes while More's list shows | Past five tabs | `'more'` | `component:TabBar` | experimental | A tab with the same value is shadowed | +| `TabBarMoreList` | one row per tab | More's screen: the tabs past the fourth, in order | While `value` is `moreValue` | none | `component:TabBar` | experimental | No tabs past the fourth renders an empty list | +| `createTabBar` | `{getState, update, destroy}` | Attaches the bar's behavior to the tab list the app renders, without React, and reports its state through `getState()` and `onStateChange`: the shown tabs, the selection, the tabs past the fourth, the lens, and whether a keyboard is up | Always | none | `component:TabBar` | experimental | FR8's options | +| `useTabBar` | one result per render | `createTabBar`'s thin React wrapper: the tab list's props, each shown tab's props and state, the tabs past the fourth, the lens's state, and whether a keyboard is up | Always | none | `component:TabBar` | experimental | As `createTabBar` | +| Lens state | `rest`, `lifted`, `dragging`, `settling` | Where a finger has the lens, and the tab it is over | Under the touch presentation | `rest` | `component:TabBar` | experimental | Not applicable | +| Action beside the tabs | the app's control | A control next to the tabs, such as a compose button; never a tab | Any bar | none | The app | experimental | Not applicable | +| Keyboard state | up, down | Whether a software keyboard is up, and its height if OQ1 rules that the bar rides | Always | down | `component:TabBar` | experimental | Not applicable | ## Behavioral and layout contract Draft requirements identify their basis so observed code is not mistaken for an intentional decision. A `current` contract contains no unresolved rows. -| ID | Candidate invariant | Basis | Draft review state | -| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | -| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | -| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | -| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | -| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | -| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | -| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | -| FR8 | `createTabBar(element, {value, onChange, onReselect?, onLensMove?, onStateChange?, moreValue?, label?, labels?, items}) → {getState(), update(options), destroy()}` MUST give `element`, the tab list the app renders, and its tabs the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props, and `destroy()` removes every listener it added. `getState()` returns, and `onStateChange` reports, what `useTabBar` returns: the shown tabs, the selection, the tabs past the fourth, and the lens's state (FR9). `labels` (`{more?, badgedItem?}`) gives each name it sets; an absent key falls back to Core's catalog message. `useTabBar(options)` is its thin React wrapper, with no behavior of its own. | DEC-1; `spec:AST-107` DEC-2; `architecture:internationalization` INV3a | human decision | -| FR9 | `createTabBar` and `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports the lens's center while it drags, in CSS pixels from the tab list's inline-start edge toward its inline end. | `spec:AST-107` DEC-1 | human decision | -| FR10 | `TabBar` MUST be built entirely on `createTabBar`, through `useTabBar`, so the component and a bar built on either choose, reselect, rove and move the lens alike. | DEC-1; `architecture:public-component-api` INV21 | human decision | -| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `createTabBar` and `useTabBar` give it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | human decision | -| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. `createTabBar` and `useTabBar` expose whether a keyboard is up, never its height (`spec:AST-099` FR3). How Lab reads the keyboard is OQ2. | Device captures with a field focused: above the keys at once where the window resizes (`interactive-widget=resizes-content`); in iPhone Safari a sliver under its address bar, and the whole bar once a scroll completes the pan; in an iPhone Home Screen app behind the keyboard's accessory bar; in Android Chrome covered, and partly shown after a scroll | human decision | +| ID | Candidate invariant | Basis | Draft review state | +| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| FR1 | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. | UITabBarController's layout | settled | +| FR2 | More MUST read as selected while `value` is `moreValue` or any tab past the fourth. | UITabBarController | settled | +| FR3 | Choosing More while it is not selected MUST call `onChange` with `moreValue`; choosing it while it is selected MUST call `onReselect` with `moreValue`, never `onChange`. | UIKit pops More's stack | settled | +| FR4 | `TabBarMoreList` takes the bar's `TabBarItem` children and MUST list every tab past the fourth, in order, with its icon, label, badge and a disclosure chevron that points to the inline end; the row whose value is `value` reads as selected, and choosing an enabled row MUST call `onChange` with its value. | UIKit's More list | settled | +| FR5 | A disabled tab's More row MUST be disabled, and choosing it MUST NOT call `onChange`. | `spec:AST-085` FR2 | settled | +| FR6 | The arrow keys MUST skip a disabled tab, which stays announced as disabled. | Core's TabList; `spec:AST-085` Non-goals and FR5 | settled | +| FR7 | The More tab's label and the list's name MUST come from Core's catalog message `@astryx.tabBar.more`. | Core's message catalog | settled | +| FR8 | `createTabBar(element, {value, onChange, onReselect?, onLensMove?, onStateChange?, moreValue?, label?, labels?, items}) → {getState(), update(options), destroy()}` MUST give `element`, the tab list the app renders, and its tabs the behavior FR1–FR7 give `TabBar`: the shown tabs, four and More past five; the selection; choosing and reselecting (FR3), with the selected tab's panel scrolling to its top; the tabs past the fourth, for a More list; and the tab list's and each tab's role, name, state and roving focus (FR6, AR1). `items` take `TabBarItem`'s props, and `destroy()` removes every listener it added. `getState()` returns, and `onStateChange` reports, what `useTabBar` returns: the shown tabs, the selection, the tabs past the fourth, the lens's state (FR9), and whether a keyboard is up (FR12). `labels` (`{more?, badgedItem?}`) gives each name it sets; an absent key falls back to Core's catalog message. `useTabBar(options)` is its thin React wrapper, with no behavior of its own. | DEC-1; `spec:AST-107` DEC-2; `architecture:internationalization` INV3a | human decision | +| FR9 | `createTabBar` and `useTabBar` MUST hand out values and props only, never a gesture recognizer, an arena or an animator. The lens is state: `lifted` while a finger holds it over a tab, `dragging` while it moves across the tabs, `settling` as it comes to rest on the chosen tab, and `rest`, each with the index of the tab it is over. `onLensMove` reports the lens's center while it drags, in CSS pixels from the tab list's inline-start edge toward its inline end. | `spec:AST-107` DEC-1 | human decision | +| FR10 | `TabBar` MUST be built entirely on `createTabBar`, through `useTabBar`, so the component and a bar built on either choose, reselect, rove and move the lens alike. | DEC-1; `architecture:public-component-api` INV21 | human decision | +| FR11 | An action beside the tabs, such as a compose button, MUST NOT be a tab: it sits outside the tab list, has no `aria-selected`, is not in the arrow keys' order, and takes none of the five slots. `createTabBar` and `useTabBar` give it no props. | The WAI-ARIA tabs pattern: a tab list holds only tabs; `TabBar.doc.mjs`: "Don't use it for actions" | human decision | +| FR12 | While the on-screen keyboard is up, TabBar MUST NOT be drawn over or above it; it MUST return when the keyboard goes down. `createTabBar` and `useTabBar` expose whether a keyboard is up, never its height (`spec:AST-099` FR3). How Lab reads the keyboard is OQ2. | Device captures with a field focused: above the keys at once where the window resizes (`interactive-widget=resizes-content`); in iPhone Safari a sliver under its address bar, and the whole bar once a scroll completes the pan; in an iPhone Home Screen app behind the keyboard's accessory bar; in Android Chrome covered, and partly shown after a scroll | human decision | - FR8–FR11 gap: `TabBar` renders its own elements, so a bar an app draws gets none of its behavior. - FR12 gap: TabBar reads no keyboard state. With a field focused, the bar shows above the keys where the window shrinks for the keyboard, and in iPhone Safari once a scroll completes the pan. In Android Chrome it shows partly after a scroll. @@ -176,6 +181,7 @@ The component implements design requirements without copying their rationale. | FR10 | TabBar's unit and interaction tests, over the component built on the factory | Every state above | A behavior that differs between the component and the hook fails them | None | | FR11 | A unit test of a drawn bar with a compose button beside the tabs | The arrow keys across the tabs, the action focused | The action inside the tab list, or in the arrow keys' order, fails it | None | | FR12 | Device captures of the bar with a field focused, in each host | Android Chrome by default and with `interactive-widget=resizes-content`, iPhone Safari with its address bar expanded and collapsed, an iPhone Home Screen app; an unclaimed and a claimed field; at rest and after a scroll | A bar drawn over or above the keyboard, or one that does not return, fails it | None | +| FR8, FR12 | Unit tests of `createTabBar` and `useTabBar` with the keyboard read stubbed | A keyboard coming up and going down | A state that misses either change, or that carries the keyboard's height, fails them | None | ## Decision log From b26ce6fe5c03b54acc8b062ca130394ffd41656e Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Mon, 16 Nov 2026 01:31:17 -0800 Subject: [PATCH 8/8] docs(TabBar): FR12 changes the released default while typing The compatibility lines say every bar hides while the on-screen keyboard is up (FR12), and keep the rest of the released default. --- docs/specs/components/TabBar/TabBar.spec.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/specs/components/TabBar/TabBar.spec.md b/docs/specs/components/TabBar/TabBar.spec.md index 7501ce007eb40..c4d008d227f82 100644 --- a/docs/specs/components/TabBar/TabBar.spec.md +++ b/docs/specs/components/TabBar/TabBar.spec.md @@ -46,7 +46,7 @@ system_specs: | Behavior | Past five tabs the bar shows four tabs and More, which lists the rest, for every pointer, as UITabBarController does. The arrow keys skip a disabled tab. A bar drawn on `createTabBar` or `useTabBar` behaves as `TabBar` does, and an action beside the tabs is never a tab. While the on-screen keyboard is up, the bar is not drawn over or above it, and it returns when the keyboard goes down (OQ1). | | End-user impact | Six or more sections stay reachable on a phone's bar, as on iOS; keyboard users never land on a disabled tab. A bar with an app's own look keeps the tab bar's names, keys and finger lens. | | Builder impact | An app with more than five tabs renders `TabBarMoreList` while `value` is `moreValue`, and shows a chosen section inside More. An app that draws its own bar renders every element from `useTabBar`'s props, or `createTabBar`'s values without React, and draws the lens from its state. | -| Compatibility/readiness | Five tabs or fewer render as before; `createTabBar` and `useTabBar` are additive. Draft. Requirement gaps: FR8–FR12. | +| Compatibility/readiness | Five tabs or fewer render as before, except that every bar hides while the on-screen keyboard is up (FR12); `createTabBar` and `useTabBar` are additive. Draft. Requirement gaps: FR8–FR12. | | Review checks | Reject a fifth slot that changes with the pointer, a More list that omits or reorders tabs, or a disabled row or tab that can be chosen. Reject a factory or hook that returns a gesture recognizer or an animator, or a hook with behavior of its own. Reject an action inside the tab list. Reject a bar drawn over or above the on-screen keyboard. | | Governing rules | `spec:AST-085` FR1, FR2 and FR5 (a disabled control stays focusable, blocks every change, and is announced as disabled); `spec:AST-107` DEC-1 and DEC-2, the shape followed (gesture hooks give products values and one method each, each over a factory); `architecture:public-component-api` INV21 and INV22; `architecture:internationalization` INV3a. `spec:AST-099` FR3 for the keyboard's state. | @@ -63,7 +63,7 @@ leave every element to the app. Consumer usage lives in `TabBar.doc.mjs`. ## Compatibility and migration -- Released default preserved: `yes` for a bar of five tabs or fewer. A bar of six or more tabs, outside the documented three to five, moves its fifth tab onward into More (FR1). +- Released default preserved: `no` while the on-screen keyboard is up (FR12); otherwise `yes` for a bar of five tabs or fewer. A bar of six or more tabs, outside the documented three to five, moves its fifth tab onward into More (FR1). - Compatibility class: additive; `moreValue`, `TabBarMoreList`, `createTabBar` and `useTabBar` are new. - Controlled/uncontrolled behavior: unchanged; the app owns `value`. - Migration decision: none needed.