fix(editor): zone handles remount per annotation so a row tap lands the focus

This commit is contained in:
bchanot committed 2026-11-19 16:21:14 +01:00
1 parent 6ad378b08b
commit f5a6eafc7f
4 files changed
+12 -6

No files matched your search

@@ -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
@@ -112,6 +112,8 @@ export default function HandleLayer(props: HandleLayerProps) {
)}
{zone && (
<ZoneHandles
// One group per annotation: a focused vertex never carries over to another polygon.
key={zone.annotationId}
zone={zone}
scale={{ unit, sizes }}
keys={props.zoneKeys}
@@ -1403,8 +1403,11 @@ describe('Safari: the focus after a press that commits a pending series', () =>
})
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])
+2 -1
View File
@@ -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.