From f5a6eafc7f9890ccb95b6b85cbb92d4e5a3a6ef6 Mon Sep 17 00:00:00 2001 From: bchanot Date: Thu, 19 Nov 2026 16:21:14 +0100 Subject: [PATCH] fix(editor): zone handles remount per annotation so a row tap lands the focus --- .../components/editor/annotations/EditableAnnotations.tsx | 6 +++--- apps/app/src/components/editor/annotations/HandleLayer.tsx | 2 ++ apps/app/tests/unit/editor-zone-edit.test.tsx | 7 +++++-- docs/development/V1-2-6_OWNER_TRIAL.md | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/app/src/components/editor/annotations/EditableAnnotations.tsx b/apps/app/src/components/editor/annotations/EditableAnnotations.tsx index 5b981bfe..689c5d7e 100644 --- a/apps/app/src/components/editor/annotations/EditableAnnotations.tsx +++ b/apps/app/src/components/editor/annotations/EditableAnnotations.tsx @@ -309,9 +309,9 @@ const guarded = (action: () => void) => () => { } /** - * A tool, a view chip or an overview row, guarded as above. Pressed with the focus still on a handle (Safari - * focuses no clicked button), the change unmounts that handle: the focus then lands on the - * pressed control, where the keyboard's press leaves it, never on `body` (rev 4 M-4). + * A tool, a view chip or an overview row, guarded as above. Pressed with the focus still on + * a handle (Safari focuses no clicked button), the change unmounts that handle: the focus + * then lands on the pressed control, where the keyboard's press leaves it, never on `body` (rev 4 M-4). */ function guardedPress(button: HTMLElement, action: () => void) { if (!guardDrawing(action)) return diff --git a/apps/app/src/components/editor/annotations/HandleLayer.tsx b/apps/app/src/components/editor/annotations/HandleLayer.tsx index 760e5179..5109a0d9 100644 --- a/apps/app/src/components/editor/annotations/HandleLayer.tsx +++ b/apps/app/src/components/editor/annotations/HandleLayer.tsx @@ -112,6 +112,8 @@ export default function HandleLayer(props: HandleLayerProps) { )} {zone && ( }) it('a press on another annotation row commits with the focus kept, then focuses the row', async () => { - // A point has no vertex handle: selecting it unmounts the focused vertex. - const other = insert(squareText(), point('y', 50, 50, 1)) + // Handles are per annotation: the focused vertex does not carry over to the other polygon. + const other = withZone(squareText(), 'y', { + type: 'polygon', + points: SQUARE, + }) await mount(other) await select() clickHandle('Sommet 1 de N', [20, 20]) diff --git a/docs/development/V1-2-6_OWNER_TRIAL.md b/docs/development/V1-2-6_OWNER_TRIAL.md index 48b5f361..0a937045 100644 --- a/docs/development/V1-2-6_OWNER_TRIAL.md +++ b/docs/development/V1-2-6_OWNER_TRIAL.md @@ -782,7 +782,8 @@ Tablette en paysage (au moins 1 024 px de large ; en dessous, l'éditeur est en 17. Tablette avec un clavier physique : le focus après chaque geste. Les flèches demandent un clavier ; un doigt sur le curseur « Taille » enregistre dès qu'il se lève, sans série en attente. Action : faites une série de flèches sur une poignée ou sur le curseur, puis touchez une poignée ; recommencez en touchant ailleurs sur le dessin, puis - « Déplacer … », « Redessiner », « Désélectionner », « − », un outil de la colonne, une pastille de vue, une ligne d'annotation et une ligne de vue de l'aperçu. + « Déplacer … », « Redessiner », « Désélectionner », « − », un outil de la colonne, une pastille de vue, + une ligne d'annotation et une ligne de vue de l'aperçu. Attendu, sur ces chemins : le focus n'est jamais perdu. La touche Tab suivante, ou une flèche, agit là où vous l'attendez. Seul un vrai iPad sous Safari prouve ce point : Chromium donne lui-même le focus à l'élément touché, ses tests n'en disent rien.