fix(editor): final review fixes (touch undo guard, focus, save line)

Important 1: a touch press fires pointer leave between up and click; only a
mouse leave (or a pointer cancel) forgets the refused field, so Annuler no
longer undoes an unrelated change. Important 2: the LAN spec reads the
revision before the attach, through shownRevision, which throws instead of NaN
(spec stays not run). Minor 1: refocusIfHidden refocuses a still shown element
the commit blurred (references search on a 1 024 px crossing). Minor 2:
discardChanges keeps lastSave (reload path still drops it). Minor 3: the
overview filter term lives in UiState / the read-only twin, not the card.
Minor 4: categories section drops its inner h3 and the unused
editor.general.categories keys. AC8: badge test.

Assertions rewritten or added (R-24):
- editor-tabs-general « Général no longer holds the categories editor »:
  queryByText of the deleted heading (now vacuous) -> queryByLabelText of the
  category name fields.
- editor-focus-request « Annotations: selects the annotation »: findAllByText
  /anno-b|Sélection/ -> the properties panel holds Centre x = 20 (anno-b) and
  owns the focused heading.
- editor-shell-layout panel walk: added after.at(-1) === 'side'.
- editor-recovery title « Annuler les modifications » -> « Abandonner ».
- new: touch/cancel/mouse press, references search crossing, discard keeps
  lastSave, filter kept, one categories heading, badge 1/2/0, shownRevision.
This commit is contained in:
bchanot committed 2026-11-09 12:19:32 +01:00
1 parent 942d52a835
commit 0467885527
22 files changed
+327 -38

No files matched your search

@@ -1,4 +1,4 @@
import { useMemo, useState } from 'react'
import { useMemo } from 'react'
import type {
AnatomicalSheetDocument,
SheetView,
@@ -29,6 +29,9 @@ export interface OverviewPanelProps {
readOnly: boolean
/** Put before every id (the read-only twin beside the kept edit panel). */
idPrefix?: string
/** The « Filtrer par nom » term, held by the parent so a selection does not lose it. */
filter: string
onFilter: (term: string) => void
onSelectView: (viewId: string) => void
onSelectAnnotation: (annotationId: string) => void
onOpenSection: (section: AnnotationSection, opener: HTMLElement) => void
@@ -193,8 +196,7 @@ function CategoriesCard(props: OverviewPanelProps) {
function AnnotationsCard(props: OverviewPanelProps) {
const t = useT()
const locale = useLocaleStore((s) => s.locale)
const { doc, viewId, onSelectAnnotation } = props
const [term, setTerm] = useState('')
const { doc, viewId, filter: term, onFilter, onSelectAnnotation } = props
const prefix = props.idPrefix ?? ''
const total = useOverviewCounts(doc).annotationsByView.get(viewId) ?? 0
const groups = useMemo(
@@ -221,7 +223,7 @@ function AnnotationsCard(props: OverviewPanelProps) {
aria-label={t('editor.overview.filter')}
placeholder={t('editor.overview.filter')}
value={term}
onChange={(event) => setTerm(event.target.value)}
onChange={(event) => onFilter(event.target.value)}
/>
{groups.length > 0 ? (
<AnnotationList