fix(editor): never drop a refused draft silently on a read-only flip

Drop slot is tile-local state; the edit view cleanup reports every pending
field (FIELDS order) only when some are pending. The tile shows a warning
note and says it once in the live region; it ends on toggle, Terminer or a
newer drop. LeaveGuard returns all refused fields (forced panel close names
them all). Pin follows editingKey through read-only; reset re-pins it.
Read-only toggle ends edit and collapses. Flip focus goes to the tile header.

R-24 mapping:
- view test "keeps its index ... read-only (M3)": renamed, same assertion
- view test "is suspended in read-only ...": rewritten as "stays pinned in
  read-only" (pin kept, tile still shown after a search); toggle test added
- reset test extended: tile in edit stays pinned through the reset
- new editor-references-flip.test.tsx covers (a)-(g); (h) is a stated limit
This commit is contained in:
bchanot committed 2026-11-13 11:11:51 +01:00
1 parent 52aac41472
commit 3303530717
15 files changed
+543 -94

No files matched your search

@@ -14,7 +14,7 @@ import { useReferenceView } from './useReferenceView'
const NO_CITERS = new Map<string, never[]>()
/** The document's references with the tab's tile state and display order. */
export function useReferenceLibrary(readOnly: boolean, resetSignal: number) {
export function useReferenceLibrary(resetSignal: number) {
const doc = useSheetDocument()
const all: readonly Reference[] = doc?.references ?? []
const keys = tileKeys(all)
@@ -23,7 +23,6 @@ export function useReferenceLibrary(readOnly: boolean, resetSignal: number) {
const shown = useReferenceView(
{ all, keys, citers },
tiles.editingKey,
readOnly,
resetSignal,
)
return { loaded: doc !== null, all, keys, tiles, citers, shown }