# Plan: V1-2.6 UX U1, editor shell (four tabs, sections, references panel, header history) > For agentic workers: executed lot by lot under `subagent-driven-development` (ship-feature STEP 4); each lot is > one coherent change, committed and pushed by the orchestrator after its own checks. Status: REVISED after the three-lens challenge (2026-11-06, record at the end), for the owner's plan checkpoint. No application code is written before the owner approves this plan (brief « U1 — Validation de la conception interne »). - Goal: replace the seven-tab level-1 shell of the draft editor by the four-tab shell of the validated v1-2-6 boards, with approach A (owner, 2026-11-06): the level-1 editors of views, categories and vertebral regions open in full-width sections of Annotations with « Retour au dessin », References in a side panel, history in the header. - Architecture: a pure navigation model (tab, Annotations section, references panel, focus request) held by the editor workspace; every visited place stays mounted and is hidden with the `hidden` attribute, so no switch loses state and no effect re-runs on a switch; the unsaved count is derived from the history the store already holds; the store gains one display field (`lastSave`, the server's save time). - Stack: React 19.2.6, Zustand 5, Tailwind 4 (`lg` 64rem, `xl` 80rem; preflight hides `[hidden]` with `!important`), vitest + happy-dom, Playwright 1.64.1 + axe on the throwaway sandbox. - Spec: contract `.claude/tasks/contracts/2026-11-06-v1-2-6-ux-u1-1123.md` (AC1-AC20, CLARIFICATIONS [gated 2026-11-06]); `docs/development/V1-2-6_UX_PLAN.md` §3 U1 and §2 G; `docs/development/V1-2-6_UX_TESTS.md` U1; `docs/development/V1-2-6_UX_DECISIONS.md` (T11, T15, T17, « Points from the boards for U1 and later »); level-1 contract `.claude/tasks/contracts/2026-11-03-v1-2-6-editor-1509.md` (header precedence rule, C3, C4, C5, C6, C11, C13, C14, C16, C27, C28, C32, C34, C36, C38, C40, C41, C44, C47 as amended); boards `docs/design/v1-2-6` 01, 11, 12 A, 13 (source `maquettes.html`: `hist()` :287, `save()` :292, `overviewPanel()` :325, board 11 :615-628); board 05 of v1-2-4 for the narrow read-only mode. - Reading list for every executor: the contract, this plan, the files named in its lot, `.claude/rules/i18n.md`, `.claude/rules/stores.md`. - Format: the project's lot format (precedent `.claude/tasks/plans/2026-11-03-v1-2-6-editor.md`): every choice is closed here, executors write the code and the tests named per lot. ## Global constraints - Worktree `/home/bchanot/Documents/faunosteo-v1-2`, branch `feature/v1-2-anatomical-sheets`, base 846994b; every shell command starts with `cd /home/bchanot/Documents/faunosteo-v1-2 &&` (LRN-110). Commit in place, push each commit, no sub-branch, no merge, no `gitflow.sh finish` (T13). - Never DEV: no `pnpm db:start`, `db:reset`, `db:test`, `db:types`, `pnpm supabase …`, `e2e:avatar`, `e2e:sheet-assets`; database work only through `pnpm db:sandbox …` (containers `faunosteo_dbsandbox_*`). - The sandbox is shared with the level-1 owner trial stack: Lot B1 runs `pnpm db:sandbox up fresh`, which wipes the trial accounts and data (`scripts/db-sandbox.sh:47-60`). Approving this plan authorises that wipe; no other checkout runs the sandbox during U1. - No change under `crates/`, `supabase/`, `scripts/`, `packages/core-wasm/src/`, `packages/supabase/src/`, `docs/design/v1-2-6/` (AC19 CHECK); `faunosteo-v1-2-6-revue-ux-chatgpt.md` never staged. - No U2-U6 operation (no handle, slider, rectangle, remap, role, opacity, own-colour revert, category fold, view menu), no V1-2.7 control (no « Prévisualiser », no withdrawal), no existing function removed (owner precision 7). - Store rules unchanged: `undoStep()` / `redoStep()`, `HISTORY_LIMIT_BYTES` 8 388 608, one commit per change on blur, confirm or pointer-up (BDR-050), the save request, the recovery copy (C13, C27, C28), conflicts (C12, C29), mode precedence (C38). Store addition: `lastSave` only (Lot E); the count is a selector. - Every string through `useT`, FR/EN key parity (AC20), counts through `usePlural` (`editor/plural.ts`, C36); new labels are proposals (C44) listed in `.claude/audits/2026-11-06-v1-2-6-u1-label-proposals.md`. Prose naming a place is reworded in the lot that moves that place. - Focus moves only through the navigation hook or a one-shot focus request; no kept-mounted component focuses or scrolls in a mount effect. - Our code: functions at most 25 logic lines, 5 params, 5 locals, 100 columns in TypeScript (project exception). `DraftEditor`, `DraftHeader`, `EditorTabs`, `FindingsTab` and `AppLayout` already exceed 25 lines: each one this plan touches is split along the lines below, never grown. - Browser suites stay green at every lot: each lot from B1 rewrites the e2e assertions its change breaks (mapped in its commit message, R-24) and runs every `apps/app/e2e/shell/editor-*.spec.ts` on the sandbox started in Lot B1 (`pnpm db:sandbox e2e-shell ` per spec); a spec that breaks and is not in the lot's list is added to the lot, never skipped. The full suites run in Lot H and in the gate order of Lot I on a new fresh sandbox. - Queries: tests never query labels or text page-wide; they scope to the visible place (`data-place` hook, below) or use role queries, which ignore hidden content. ## Review focus (failure modes no single lot owns; each pinned by a test in the named lot) 1. A hidden place answers instead of the visible one: a focus request consumed by a hidden body, a label or text locator matching a hidden copy (« Nom (FR) » labels the sheet, a region and an annotation), a static `id` repeated. Pinned in Lot B2 (requests routed to their owner, unique ids once every place is visited, Chromium spec of the keep-alive and focus rules) and every lot's e2e scoping. 2. Undo from another place removes what a kept place still shows: the canvas's current view (with a pending creation or a tracing on it), the selected annotation, the finding the references filter names. Pinned in Lot B1 (full canvas reset to the main view) and Lot D (filter falls back to « Tout afficher »). 3. The save line says something false: a count after undoing past the save point, after a trim by a commit, an undo or a redo, after a restored copy, after commits or undos during a save; a time from another revision or an old save. Pinned in Lot E (`savedDistance` table, including the sequences the challengers found; `saveLineState` table; `readSaveTime` drops late answers and is skipped on `draft.unchanged`). 4. A width change across 1 024 px with a section or the panel open: every place turns read-only in place, unsaved document changes kept, edit mode back on widening, no crash. Creation forms (canvas pending creation and every `!readOnly` form) unmount as today: documented limit, section 2. Pinned in Lot H. 5. The references panel over the header: Enregistrer, Annuler and Rétablir must stay clickable with the panel open. Pinned in Lot D (Chromium check at 1 024 and 1 280 px). --- ## Architecture (closed decisions) ### 1. Navigation model (owner precisions 1, 2, 10) - New pure module `apps/app/src/editor/navigation.ts`: - `ANNOTATION_SECTIONS = ['drawing', 'views', 'categories', 'regions'] as const`, `AnnotationSection`. - `EditorTarget = { place: 'tab'; tab: EditorTabId; section: AnnotationSection | null; key: ElementKey | null } | { place: 'references'; key: ElementKey | null; citedBy: ElementKey | null }`. One encoding: a target on Annotations always names its section (`'drawing'` for the canvas); `section` is null on the other tabs. - `targetOfKey(key: ElementKey): EditorTarget`: `sheet` → general; `zone`, `finding` → findings; `annotation` → annotations/drawing; `view` → annotations/views; `category` → annotations/categories; `region` → annotations/regions; `reference` → references (citedBy null). The only place a key meets a place. - `FocusRequest = { target: EditorTarget; serial: number }` is defined here (Lot A) and re-exported by `editor/focusRequest.ts` from Lot B1. - `NavigationState = { tab; section; references: { open: boolean; citedBy: ElementKey | null }; visitedTabs: readonly EditorTabId[]; visitedSections: readonly AnnotationSection[]; referencesMounted: boolean; focus: FocusRequest | undefined }`; `initialNavigation(tab)`. - `navigationReducer(state, action)`, actions `select_tab` (manual; keeps the Annotations section; no focus request), `open_section`, `back_to_drawing`, `open_references` (citedBy) and `close_references` (both keep tab and section: the panel opens over whatever is shown), `go_to` (target: sets tab, section or panel; `focus = { target, serial: previous + 1 }`), `focus_consumed` (serial). Visited lists grow, never shrink. - `useFocusRequest(focus, apply: (target) => 'found' | 'kept' | 'none')` reports `consumed(serial, outcome)` through `FocusConsumedContext` (`kept`: the place kept a creation or tracing in progress instead of jumping, section 4); `useRowFocus` returns `found` or `none`. A request is passed only to the body, section or panel its target names; `FindingsTab`'s `focusId` becomes one-shot (cleared once applied, `findings/FindingTree.tsx:31-33`, `tabs/FindingsTab.tsx:47,73,90`), so a later visit never re-focuses the tree and a second « Aller à » to the same finding focuses it again. - New hook `apps/app/src/editor/useEditorNavigation.ts`, called in the new `EditorWorkspace` (rendered only once the version is ready, so `initialTab(previewState, tier)` is known at mount: lazy `useReducer` initialiser, no render-phase `setTab`, no reset action; reloads keep `status: 'ready'`, `editorLoad.ts:136-152`). It owns the DOM side: - stable callbacks (`useCallback` over `dispatch`): `navigate(target, opener?)`, `selectTab(tab)`, `openSection(section, opener)`, `backToDrawing()`, `openReferences(citedBy, opener)`, `closeReferences()`; - before every move (tab click or key, « Plus » item, section entry, « Retour au dessin », panel open, panel close by ✕, Escape or scrim, « Aller à », hint link), `commitFocusedField()` (new in `editor/focusRequest.ts`): when `document.activeElement` is an `input`, `textarea` or `select` inside the editor, `blur()` it, so its `TextField` commits on blur (`TextField.tsx:75-79`) before the place is hidden. Today an unmount commits that text (`TextField.tsx:61-68`); kept-mounted places never unmount, and Safari and iPadOS do not move focus to a tapped button, so the blur is forced rather than assumed (confirmation challenge); - openers kept in a ref (`section`, `references`), never in state; - after each programmatic move, in an effect keyed on the move: focus the request's element, else the section heading, the panel heading, the active tab button `#editor-tab-`, or « Plus » when the active tab sits in the closed « Plus » list (< 640 px); never `body`; - one polite live region text `{ text, serial }` on programmatic moves only (go to, hint links, section open and back, panel open and close): « Annotations · Vues », « Références »; rendered as `

`, distinct from the save status (AC12); a repeated text alternates a trailing no-break space. - `EditorTabProps` becomes `EditorPlaceProps = { readOnly: boolean; navigate: (target: EditorTarget, opener?: HTMLElement | null) => void; focus?: FocusRequest; reloadSheet: () => void }`. The route computes `readOnly` once and passes `!readOnly` to `useUndoShortcuts` and to the history buttons (no third spelling of the predicate). ### 2. Kept-mounted places (precision 1: no silent loss on a tab, section or panel change) - Each visited tab panel, each visited Annotations section and the references panel once opened stay mounted inside a plain wrapper `