fix(editor): name vertex handles after their zone, in a named group

Criterion 18: « Sommet {n} de {nom} », « Ajouter un sommet après le sommet
{n} de {nom} », « Retirer le sommet {n} de {nom} » (EN « Vertex {n} of
{name} » …), {nom} the zone's display name in the current locale; the
handle group is a role="group" named « Sommets de {nom} ».

Tests: no assertion removed; every unit and e2e locator that read the old
names now reads the same handle with the zone name appended (fixtures: N,
Vertèbres thoraciques, Zone dessinée, Zone clavier). New unit tests in
editor-zone-edit cover the FR names, the group and the EN locale.
This commit is contained in:
bchanot committed 2026-11-18 14:09:24 +01:00
1 parent fab641c278
commit b6aa2819ea
15 files changed
+165 -67

No files matched your search

@@ -295,11 +295,15 @@ test.describe('editor annotations (A3)', () => {
// « + » after vertex 1 by Enter: four vertices; Delete on the chosen one: three again. // « + » after vertex 1 by Enter: four vertices; Delete on the chosen one: three again.
await page await page
.getByRole('button', { name: 'Ajouter un sommet après le sommet 1' }) .getByRole('button', {
name: 'Ajouter un sommet après le sommet 1 de Zone clavier',
})
.focus() .focus()
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await expect.poll(async () => (await shownPoints(page)).length).toBe(4) await expect.poll(async () => (await shownPoints(page)).length).toBe(4)
await page.getByRole('button', { name: 'Sommet 2', exact: true }).focus() await page
.getByRole('button', { name: 'Sommet 2 de Zone clavier', exact: true })
.focus()
await page.keyboard.press('Delete') await page.keyboard.press('Delete')
await expect.poll(async () => (await shownPoints(page)).length).toBe(3) await expect.poll(async () => (await shownPoints(page)).length).toBe(3)
// Escape unchooses the vertex (board 32 row 5): the strip offers the zone's move. // Escape unchooses the vertex (board 32 row 5): the strip offers the zone's move.
+4 -1
View File
@@ -222,7 +222,10 @@ async function modifyAnnotations(page: Page) {
await expect(shownShape(page)).toHaveAttribute('cx', String(point)) await expect(shownShape(page)).toHaveAttribute('cx', String(point))
await pickAnnotation(page, dict, /Zone dessinée/) await pickAnnotation(page, dict, /Zone dessinée/)
const [[start]] = await shownPoints(page) const [[start]] = await shownPoints(page)
const first = page.getByRole('button', { name: 'Sommet 1', exact: true }) const first = page.getByRole('button', {
name: 'Sommet 1 de Zone dessinée',
exact: true,
})
const vertex = await stepRight(page, first, start, MODIFIED.vertex) const vertex = await stepRight(page, first, start, MODIFIED.vertex)
await expect.poll(async () => (await shownPoints(page))[0][0]).toBe(vertex) await expect.poll(async () => (await shownPoints(page))[0][0]).toBe(vertex)
await pickAnnotation(page, dict, /Accès essai/) await pickAnnotation(page, dict, /Accès essai/)
+10 -5
View File
@@ -104,7 +104,9 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
// The row sits low in the equine list: the click left the drawing out of view. // The row sits low in the equine list: the click left the drawing out of view.
await scrollToTop(page) await scrollToTop(page)
await expect(selectionTag(page)).toContainText('Vertèbres thoraciques') await expect(selectionTag(page)).toContainText('Vertèbres thoraciques')
await expect(handle(page, 'Sommet 9')).toBeAttached() await expect(
handle(page, 'Sommet 9 de Vertèbres thoraciques'),
).toBeAttached()
// R-18: at fit zoom some segments are too short for their « + ». // R-18: at fit zoom some segments are too short for their « + ».
await expect(page.getByTestId('edit-strip-notice')).toContainText( await expect(page.getByTestId('edit-strip-notice')).toContainText(
dict['editor.annotations.strip.zoom_hint'], dict['editor.annotations.strip.zoom_hint'],
@@ -125,7 +127,10 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
// « + » on the segment from vertex 2: a vertex added and chosen, then undone. // « + » on the segment from vertex 2: a vertex added and chosen, then undone.
await expectNoShift(page, async () => { await expectNoShift(page, async () => {
await pressHandle(page, 'Ajouter un sommet après le sommet 2') await pressHandle(
page,
'Ajouter un sommet après le sommet 2 de Vertèbres thoraciques',
)
await expect(line(page)).toContainText( await expect(line(page)).toContainText(
dict['editor.annotations.message.vertex_added'], dict['editor.annotations.message.vertex_added'],
) )
@@ -138,13 +143,13 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
// « − » on the chosen vertex 3, then undone. // « − » on the chosen vertex 3, then undone.
await expectNoShift(page, async () => { await expectNoShift(page, async () => {
await pressHandle(page, 'Sommet 3') await pressHandle(page, 'Sommet 3 de Vertèbres thoraciques')
await expect(page.getByTestId('edit-strip-detail')).toContainText( await expect(page.getByTestId('edit-strip-detail')).toContainText(
'sommet 3 choisi', 'sommet 3 choisi',
) )
}) })
await expectNoShift(page, async () => { await expectNoShift(page, async () => {
await pressHandle(page, 'Retirer le sommet 3') await pressHandle(page, 'Retirer le sommet 3 de Vertèbres thoraciques')
await expect(line(page)).toContainText( await expect(line(page)).toContainText(
dict['editor.annotations.message.vertex_removed'], dict['editor.annotations.message.vertex_removed'],
) )
@@ -172,7 +177,7 @@ test.describe('editor zones on the drawing (U2 Task 5)', () => {
requests.forbid(actor.account.email, actor.account.password) requests.forbid(actor.account.email, actor.account.password)
await pickAnnotation(page, dict, THORACIC) await pickAnnotation(page, dict, THORACIC)
const [, second] = await shownPoints(page) const [, second] = await shownPoints(page)
await handle(page, 'Sommet 2').focus() await handle(page, 'Sommet 2 de Vertèbres thoraciques').focus()
await page.keyboard.press('ArrowDown') await page.keyboard.press('ArrowDown')
// Not under expectNoShift: the button returns the focus to the list row, which // Not under expectNoShift: the button returns the focus to the list row, which
// scrolls it into view by design. // scrolls it into view by design.
+8 -3
View File
@@ -125,14 +125,19 @@ async function dragVertex(page: Page) {
async function chooseVertex3(page: Page) { async function chooseVertex3(page: Page) {
const detail = page.getByTestId('edit-strip-detail') const detail = page.getByTestId('edit-strip-detail')
if ((await detail.textContent())?.includes('sommet 3 choisi')) return if ((await detail.textContent())?.includes('sommet 3 choisi')) return
await pressHandle(page, 'Sommet 3') await pressHandle(page, 'Sommet 3 de Vertèbres thoraciques')
await expect(detail).toContainText('sommet 3 choisi') await expect(detail).toContainText('sommet 3 choisi')
} }
const GESTURES: Record<Gesture, (page: Page) => Promise<void>> = { const GESTURES: Record<Gesture, (page: Page) => Promise<void>> = {
drag: dragVertex, drag: dragVertex,
insert: (page) => pressHandle(page, 'Ajouter un sommet après le sommet 2'), insert: (page) =>
remove: (page) => pressHandle(page, 'Retirer le sommet 3'), pressHandle(
page,
'Ajouter un sommet après le sommet 2 de Vertèbres thoraciques',
),
remove: (page) =>
pressHandle(page, 'Retirer le sommet 3 de Vertèbres thoraciques'),
} }
/** Back to the stored zone with an empty undo stack, checked. */ /** Back to the stored zone with an empty undo stack, checked. */
+4 -1
View File
@@ -118,7 +118,10 @@ async function follow(from: { x: number; y: number }, moveTo: Mover) {
async function vertexCentre(page: Page) { async function vertexCentre(page: Page) {
const box = (await page const box = (await page
.getByRole('button', { name: 'Sommet 1', exact: true }) .getByRole('button', {
name: 'Sommet 1 de Vertèbres thoraciques',
exact: true,
})
.locator('[data-handle]') .locator('[data-handle]')
.boundingBox())! .boundingBox())!
return { x: box.x + box.width / 2, y: box.y + box.height / 2 } return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
@@ -327,7 +327,11 @@ function CanvasStage({
// A12: during a creation nothing else is selected or opened from the drawing. // A12: during a creation nothing else is selected or opened from the drawing.
const free = creation === null const free = creation === null
const points = shown ? handledPoints(work.target?.geometry ?? null) : null const points = shown ? handledPoints(work.target?.geometry ?? null) : null
const zone = points && { annotationId: work.target!.id, points } const zone = points && {
annotationId: work.target!.id,
name: annotationName(work.target!, doc.views, locale),
points,
}
const view = doc.views.find((v) => v.id === scene.viewId) const view = doc.views.find((v) => v.id === scene.viewId)
const blocked = !model.measured || doc.categories.length === 0 const blocked = !model.measured || doc.categories.length === 0
if (!view) return null if (!view) return null
@@ -9,6 +9,8 @@ import { useT } from '@/i18n/useT'
/** The selected polygon whose vertex, « + » and « − » handles the layer draws. */ /** The selected polygon whose vertex, « + » and « − » handles the layer draws. */
export interface ZoneHandle { export interface ZoneHandle {
annotationId: string annotationId: string
/** Its display name in the current locale: « Sommet 3 de {nom} ». */
name: string
points: Point[] points: Point[]
} }
@@ -303,9 +305,20 @@ export default function ZoneHandles({
const group = useFocusFollowsChoice(chosen) const group = useFocusFollowsChoice(chosen)
const inserts = shownInserts(points, scale) const inserts = shownInserts(points, scale)
const named = (key: string, n: number) => const named = (key: string, n: number) =>
t(`editor.annotations.handle.${key}`).replace('{n}', String(n + 1)) t(`editor.annotations.handle.${key}`)
.replace('{n}', String(n + 1))
.replace('{name}', () => zone.name)
const groupName = t('editor.annotations.handle.group').replace(
'{name}',
() => zone.name,
)
return ( return (
<g ref={group} data-testid="zone-handles"> <g
ref={group}
role="group"
aria-label={groupName}
data-testid="zone-handles"
>
{points.map((p, i) => {points.map((p, i) =>
inserts[i] ? ( inserts[i] ? (
<Insert <Insert
+4 -3
View File
@@ -1837,9 +1837,10 @@ export const en: Dict = {
'editor.annotations.move.confirm': 'Confirm position', 'editor.annotations.move.confirm': 'Confirm position',
'editor.annotations.move.cancel': 'Cancel', 'editor.annotations.move.cancel': 'Cancel',
'editor.annotations.handle.shape': '{kind} {name}', 'editor.annotations.handle.shape': '{kind} {name}',
'editor.annotations.handle.vertex': 'Vertex {n}', 'editor.annotations.handle.group': 'Vertices of {name}',
'editor.annotations.handle.insert': 'Add a vertex after vertex {n}', 'editor.annotations.handle.vertex': 'Vertex {n} of {name}',
'editor.annotations.handle.remove': 'Remove vertex {n}', 'editor.annotations.handle.insert': 'Add a vertex after vertex {n} of {name}',
'editor.annotations.handle.remove': 'Remove vertex {n} of {name}',
'editor.annotations.strip.vertex_chosen': '{detail} · vertex {n} chosen', 'editor.annotations.strip.vertex_chosen': '{detail} · vertex {n} chosen',
'editor.annotations.strip.too_many_one': 'editor.annotations.strip.too_many_one':
'{kind} · {count} vertex, too many for handles', '{kind} · {count} vertex, too many for handles',
+5 -3
View File
@@ -1906,9 +1906,11 @@ export const fr: Dict = {
'editor.annotations.move.confirm': 'Valider la position', 'editor.annotations.move.confirm': 'Valider la position',
'editor.annotations.move.cancel': 'Annuler', 'editor.annotations.move.cancel': 'Annuler',
'editor.annotations.handle.shape': '{kind} {name}', 'editor.annotations.handle.shape': '{kind} {name}',
'editor.annotations.handle.vertex': 'Sommet {n}', 'editor.annotations.handle.group': 'Sommets de {name}',
'editor.annotations.handle.insert': 'Ajouter un sommet après le sommet {n}', 'editor.annotations.handle.vertex': 'Sommet {n} de {name}',
'editor.annotations.handle.remove': 'Retirer le sommet {n}', 'editor.annotations.handle.insert':
'Ajouter un sommet après le sommet {n} de {name}',
'editor.annotations.handle.remove': 'Retirer le sommet {n} de {name}',
'editor.annotations.strip.vertex_chosen': '{detail} · sommet {n} choisi', 'editor.annotations.strip.vertex_chosen': '{detail} · sommet {n} choisi',
'editor.annotations.strip.too_many_one': 'editor.annotations.strip.too_many_one':
'{kind} · {count} sommet, trop pour les poignées', '{kind} · {count} sommet, trop pour les poignées',
@@ -708,7 +708,7 @@ describe('polygons and paths', () => {
it('« + » adds a vertex on the drawing and « − » removes it', async () => { it('« + » adds a vertex on the drawing and « − » removes it', async () => {
await mount({ text: zoneText({ type: 'polygon', points: triangle }) }) await mount({ text: zoneText({ type: 'polygon', points: triangle }) })
await selectFromList() await selectFromList()
pressAt(handleHit('Ajouter un sommet après le sommet 1'), 50, 20) pressAt(handleHit('Ajouter un sommet après le sommet 1 de N'), 50, 20)
expect(geometryOf('zone-a')).toMatchObject({ expect(geometryOf('zone-a')).toMatchObject({
points: [ points: [
[20, 20], [20, 20],
@@ -717,16 +717,16 @@ describe('polygons and paths', () => {
[50, 80], [50, 80],
], ],
}) })
pressAt(handleHit('Retirer le sommet 2'), 50, 10) pressAt(handleHit('Retirer le sommet 2 de N'), 50, 10)
expect(geometryOf('zone-a')).toMatchObject({ points: triangle }) expect(geometryOf('zone-a')).toMatchObject({ points: triangle })
}) })
it('never removes a vertex below three: « − » is greyed', async () => { it('never removes a vertex below three: « − » is greyed', async () => {
await mount({ text: zoneText({ type: 'polygon', points: triangle }) }) await mount({ text: zoneText({ type: 'polygon', points: triangle }) })
await selectFromList() await selectFromList()
pressAt(handleHit('Sommet 1'), 20, 20) pressAt(handleHit('Sommet 1 de N'), 20, 20)
expect( expect(
screen.getByRole('button', { name: 'Retirer le sommet 1' }), screen.getByRole('button', { name: 'Retirer le sommet 1 de N' }),
).toHaveAttribute('aria-disabled', 'true') ).toHaveAttribute('aria-disabled', 'true')
}) })
@@ -909,7 +909,7 @@ describe('refusals through the tab (H8)', () => {
await selectFromList() await selectFromList()
const before = store.getState().documentText const before = store.getState().documentText
const vertex = screen const vertex = screen
.getByRole('button', { name: 'Sommet 1' }) .getByRole('button', { name: 'Sommet 1 de N' })
.querySelector('[data-handle]')! .querySelector('[data-handle]')!
mouseDrag(vertex, [20, 20], [500, 20]) mouseDrag(vertex, [20, 20], [500, 20])
expect(store.getState().documentText).toBe(before) expect(store.getState().documentText).toBe(before)
+5 -5
View File
@@ -161,7 +161,7 @@ describe('the two-finger hint (R-1)', () => {
it('never replaces a message that shows', async () => { it('never replaces a message that shows', async () => {
await mount() await mount()
await select() await select()
drag(hitOf('Sommet 2'), [80, 20], [90, 10], 'mouse') drag(hitOf('Sommet 2 de N'), [80, 20], [90, 10], 'mouse')
expect(line()).toHaveTextContent('Sommet déplacé') expect(line()).toHaveTextContent('Sommet déplacé')
drag(canvas(), [5, 5], [45, 5]) drag(canvas(), [5, 5], [45, 5])
expect(line()).toHaveTextContent('Sommet déplacé') expect(line()).toHaveTextContent('Sommet déplacé')
@@ -209,7 +209,7 @@ describe('the loupe of a finger drag', () => {
.querySelector('svg')! .querySelector('svg')!
drawing.setAttribute('id', 'drawing-root') drawing.setAttribute('id', 'drawing-root')
drawing.firstElementChild?.setAttribute('id', 'drawing-part') drawing.firstElementChild?.setAttribute('id', 'drawing-part')
const vertex = hitOf('Sommet 2') const vertex = hitOf('Sommet 2 de N')
fireEvent.pointerDown(vertex, finger(1, 80, 20)) fireEvent.pointerDown(vertex, finger(1, 80, 20))
fireEvent.pointerMove(vertex, finger(1, 95, 35)) fireEvent.pointerMove(vertex, finger(1, 95, 35))
expect(loupe()).not.toBeNull() expect(loupe()).not.toBeNull()
@@ -222,7 +222,7 @@ describe('the loupe of a finger drag', () => {
it('shows a picture of the drawing above the finger, then goes on the drop', async () => { it('shows a picture of the drawing above the finger, then goes on the drop', async () => {
await mount() await mount()
await select() await select()
const vertex = hitOf('Sommet 2') const vertex = hitOf('Sommet 2 de N')
fireEvent.pointerDown(vertex, finger(1, 80, 20)) fireEvent.pointerDown(vertex, finger(1, 80, 20))
fireEvent.pointerMove(vertex, finger(1, 95, 35)) fireEvent.pointerMove(vertex, finger(1, 95, 35))
const shown = loupe()! const shown = loupe()!
@@ -239,7 +239,7 @@ describe('the loupe of a finger drag', () => {
it('goes when the drag is cancelled by a second finger', async () => { it('goes when the drag is cancelled by a second finger', async () => {
await mount() await mount()
await select() await select()
const vertex = hitOf('Sommet 2') const vertex = hitOf('Sommet 2 de N')
fireEvent.pointerDown(vertex, finger(1, 80, 20)) fireEvent.pointerDown(vertex, finger(1, 80, 20))
fireEvent.pointerMove(vertex, finger(1, 95, 35)) fireEvent.pointerMove(vertex, finger(1, 95, 35))
expect(loupe()).not.toBeNull() expect(loupe()).not.toBeNull()
@@ -250,7 +250,7 @@ describe('the loupe of a finger drag', () => {
it('a mouse drag shows none', async () => { it('a mouse drag shows none', async () => {
await mount() await mount()
await select() await select()
const vertex = hitOf('Sommet 2') const vertex = hitOf('Sommet 2 de N')
fireEvent.pointerDown(vertex, finger(1, 80, 20, 'mouse')) fireEvent.pointerDown(vertex, finger(1, 80, 20, 'mouse'))
fireEvent.pointerMove(vertex, finger(1, 95, 35, 'mouse')) fireEvent.pointerMove(vertex, finger(1, 95, 35, 'mouse'))
expect(loupe()).toBeNull() expect(loupe()).toBeNull()
+84 -32
View File
@@ -133,11 +133,13 @@ const mouse = {
const hitOf = (name: string) => const hitOf = (name: string) =>
screen.getByRole('button', { name }).querySelector('[data-handle]')! screen.getByRole('button', { name }).querySelector('[data-handle]')!
const vertex = (n: number) => const vertex = (n: number) =>
screen.getByRole('button', { name: `Sommet ${n}` }) screen.getByRole('button', { name: `Sommet ${n} de N` })
const plus = (n: number) => const plus = (n: number) =>
screen.getByRole('button', { name: `Ajouter un sommet après le sommet ${n}` }) screen.getByRole('button', {
name: `Ajouter un sommet après le sommet ${n} de N`,
})
const minus = (n: number) => const minus = (n: number) =>
screen.getByRole('button', { name: `Retirer le sommet ${n}` }) screen.getByRole('button', { name: `Retirer le sommet ${n} de N` })
const clickHandle = (name: string, at: [number, number] = [0, 0]) => const clickHandle = (name: string, at: [number, number] = [0, 0]) =>
pressAt(hitOf(name), at[0], at[1]) pressAt(hitOf(name), at[0], at[1])
const marker = (id: string) => const marker = (id: string) =>
@@ -166,7 +168,7 @@ describe('a vertex (R-9)', () => {
await mount(squareText()) await mount(squareText())
await select() await select()
expect(detail()).toHaveTextContent('Zone · 4 sommets') expect(detail()).toHaveTextContent('Zone · 4 sommets')
clickHandle('Sommet 2', [80, 20]) clickHandle('Sommet 2 de N', [80, 20])
expect(chosen()).toEqual({ expect(chosen()).toEqual({
annotationId: 'z', annotationId: 'z',
vertex: 1, vertex: 1,
@@ -185,11 +187,11 @@ describe('a vertex (R-9)', () => {
await mount(squareText()) await mount(squareText())
await select() await select()
const before = depth() const before = depth()
drag(hitOf('Sommet 2'), [80, 20], [90, 10]) drag(hitOf('Sommet 2 de N'), [80, 20], [90, 10])
expect(pointsOf('z')![1]).toEqual([90, 10]) expect(pointsOf('z')![1]).toEqual([90, 10])
expect(depth()).toBe(before + 1) expect(depth()).toBe(before + 1)
expect(message()).toHaveTextContent('Sommet déplacé') expect(message()).toHaveTextContent('Sommet déplacé')
drag(hitOf('Sommet 2'), [90, 10], [80, 80]) drag(hitOf('Sommet 2 de N'), [90, 10], [80, 80])
expect(pointsOf('z')![1]).toEqual([90, 10]) expect(pointsOf('z')![1]).toEqual([90, 10])
expect(depth()).toBe(before + 1) expect(depth()).toBe(before + 1)
}) })
@@ -198,7 +200,7 @@ describe('a vertex (R-9)', () => {
await mount(squareText()) await mount(squareText())
await select() await select()
const before = depth() const before = depth()
clickHandle('Ajouter un sommet après le sommet 1', [50, 20]) clickHandle('Ajouter un sommet après le sommet 1 de N', [50, 20])
expect(pointsOf('z')).toEqual([[20, 20], [50, 20], ...SQUARE.slice(1)]) expect(pointsOf('z')).toEqual([[20, 20], [50, 20], ...SQUARE.slice(1)])
expect(depth()).toBe(before + 1) expect(depth()).toBe(before + 1)
expect(chosen()).toMatchObject({ vertex: 1 }) expect(chosen()).toMatchObject({ vertex: 1 })
@@ -211,8 +213,8 @@ describe('a vertex (R-9)', () => {
await mount(squareText()) await mount(squareText())
render(<UndoKeys />) render(<UndoKeys />)
await select() await select()
clickHandle('Ajouter un sommet après le sommet 1', [50, 20]) clickHandle('Ajouter un sommet après le sommet 1 de N', [50, 20])
const bubble = hitOf('Retirer le sommet 2') const bubble = hitOf('Retirer le sommet 2 de N')
fireEvent.keyDown(document.body, { key: 'z', ctrlKey: true }) fireEvent.keyDown(document.body, { key: 'z', ctrlKey: true })
expect(pointsOf('z')).toEqual(SQUARE) expect(pointsOf('z')).toEqual(SQUARE)
expect(chosen()).toBeNull() expect(chosen()).toBeNull()
@@ -232,8 +234,8 @@ describe('a vertex (R-9)', () => {
it('« − » removes the chosen vertex', async () => { it('« − » removes the chosen vertex', async () => {
await mount(squareText()) await mount(squareText())
await select() await select()
clickHandle('Sommet 3', [80, 80]) clickHandle('Sommet 3 de N', [80, 80])
clickHandle('Retirer le sommet 3', [80, 70]) clickHandle('Retirer le sommet 3 de N', [80, 70])
expect(pointsOf('z')).toEqual([SQUARE[0], SQUARE[1], SQUARE[3]]) expect(pointsOf('z')).toEqual([SQUARE[0], SQUARE[1], SQUARE[3]])
expect(chosen()).toBeNull() expect(chosen()).toBeNull()
expect(message()).toHaveTextContent('Sommet retiré') expect(message()).toHaveTextContent('Sommet retiré')
@@ -244,9 +246,9 @@ describe('a vertex (R-9)', () => {
await mount(squareText(triangle)) await mount(squareText(triangle))
await select() await select()
const before = depth() const before = depth()
clickHandle('Sommet 1', [20, 20]) clickHandle('Sommet 1 de N', [20, 20])
expect(minus(1)).toHaveAttribute('aria-disabled', 'true') expect(minus(1)).toHaveAttribute('aria-disabled', 'true')
clickHandle('Retirer le sommet 1', [20, 10]) clickHandle('Retirer le sommet 1 de N', [20, 10])
expect(pointsOf('z')).toEqual(triangle) expect(pointsOf('z')).toEqual(triangle)
expect(depth()).toBe(before) expect(depth()).toBe(before)
expect(message()).toHaveTextContent('Une zone garde au moins 3 sommets') expect(message()).toHaveTextContent('Une zone garde au moins 3 sommets')
@@ -279,14 +281,64 @@ describe('a vertex (R-9)', () => {
.getAllByRole('button') .getAllByRole('button')
.filter((b) => b.closest('[data-testid="handle-layer"]')) .filter((b) => b.closest('[data-testid="handle-layer"]'))
.map((b) => b.getAttribute('aria-label')) .map((b) => b.getAttribute('aria-label'))
expect(order).toContain('Ajouter un sommet après le sommet 4') expect(order).toContain('Ajouter un sommet après le sommet 4 de N')
expect(order).toContain('Sommet 4') expect(order).toContain('Sommet 4 de N')
fireEvent.keyDown(plus(4), { key: 'Enter' }) fireEvent.keyDown(plus(4), { key: 'Enter' })
expect(pointsOf('z')).toHaveLength(5) expect(pointsOf('z')).toHaveLength(5)
expect(pointsOf('z')![4]).toEqual([20, 50]) expect(pointsOf('z')![4]).toEqual([20, 50])
}) })
}) })
describe('handle names carry the zone name (criterion 18)', () => {
const named = (name: { fr: string; en: string }) =>
insert(drawnText(), {
kind: 'annotation',
value: {
...zone('z', { type: 'polygon', points: SQUARE }),
name,
} as Annotation,
})
it('« Sommet {n} de {nom} », the « + » and « − » too, in a named group', async () => {
await mount(named({ fr: 'Thoraciques', en: 'Thoracic' }))
await select()
expect(
screen.getByRole('group', { name: 'Sommets de Thoraciques' }),
).toBeInTheDocument()
clickHandle('Sommet 2 de Thoraciques', [80, 20])
expect(
screen.getByRole('button', {
name: 'Ajouter un sommet après le sommet 1 de Thoraciques',
}),
).toBeInTheDocument()
expect(
screen.getByRole('button', {
name: 'Retirer le sommet 2 de Thoraciques',
}),
).toBeInTheDocument()
})
it('in English, the name of the current locale', async () => {
useLocaleStore.setState({ locale: 'en' })
await mount(named({ fr: 'Thoraciques', en: 'Thoracic' }))
const list = await screen.findByRole('list', {
name: 'Annotations of the view',
})
await userEvent.setup().click(within(list).getAllByRole('button')[0])
expect(
await screen.findByRole('group', { name: 'Vertices of Thoracic' }),
).toBeInTheDocument()
expect(
screen.getByRole('button', { name: 'Vertex 3 of Thoracic' }),
).toBeInTheDocument()
expect(
screen.getByRole('button', {
name: 'Add a vertex after vertex 3 of Thoracic',
}),
).toBeInTheDocument()
})
})
describe('a double click on a handle (R-8, carried Task 2 gap)', () => { describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
const twice = (el: Element, x: number, y: number) => { const twice = (el: Element, x: number, y: number) => {
pressAt(el, x, y) pressAt(el, x, y)
@@ -297,7 +349,7 @@ describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
await mount(squareText()) await mount(squareText())
await select() await select()
const before = depth() const before = depth()
twice(hitOf('Ajouter un sommet après le sommet 1'), 50, 20) twice(hitOf('Ajouter un sommet après le sommet 1 de N'), 50, 20)
expect(pointsOf('z')).toHaveLength(5) expect(pointsOf('z')).toHaveLength(5)
expect(depth()).toBe(before + 1) expect(depth()).toBe(before + 1)
}) })
@@ -306,7 +358,7 @@ describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
await mount(squareText()) await mount(squareText())
await select() await select()
const spy = vi.spyOn(useAnnotationWork, 'setState') const spy = vi.spyOn(useAnnotationWork, 'setState')
twice(hitOf('Sommet 2'), 80, 20) twice(hitOf('Sommet 2 de N'), 80, 20)
const choices = spy.mock.calls.filter( const choices = spy.mock.calls.filter(
([patch]) => typeof patch === 'object' && 'chosen' in patch, ([patch]) => typeof patch === 'object' && 'chosen' in patch,
) )
@@ -318,9 +370,9 @@ describe('a double click on a handle (R-8, carried Task 2 gap)', () => {
it('on « − »: one removal, never a second', async () => { it('on « − »: one removal, never a second', async () => {
await mount(squareText([...SQUARE, [10, 50]])) await mount(squareText([...SQUARE, [10, 50]]))
await select() await select()
clickHandle('Sommet 2', [80, 20]) clickHandle('Sommet 2 de N', [80, 20])
const before = depth() const before = depth()
pressAt(hitOf('Retirer le sommet 2'), 80, 10) pressAt(hitOf('Retirer le sommet 2 de N'), 80, 10)
// The second click of the double click lands on what is there now, at the same place. // The second click of the double click lands on what is there now, at the same place.
pressAt(liveBubbleOrCanvas(), 80, 10) pressAt(liveBubbleOrCanvas(), 80, 10)
expect(pointsOf('z')).toHaveLength(4) expect(pointsOf('z')).toHaveLength(4)
@@ -364,7 +416,7 @@ describe('moving the zone (A11, R-12)', () => {
it('« Déplacer le sommet » moves the chosen vertex only', async () => { it('« Déplacer le sommet » moves the chosen vertex only', async () => {
await mount(squareText()) await mount(squareText())
await select() await select()
clickHandle('Sommet 3', [80, 80]) clickHandle('Sommet 3 de N', [80, 80])
await userEvent await userEvent
.setup() .setup()
.click(screen.getByRole('button', { name: 'Déplacer le sommet' })) .click(screen.getByRole('button', { name: 'Déplacer le sommet' }))
@@ -444,10 +496,10 @@ describe('paths (UX_TESTS « Paths »)', () => {
await mount(pathAndZone()) await mount(pathAndZone())
const before = JSON.stringify(annotationOf('p').geometry) const before = JSON.stringify(annotationOf('p').geometry)
await select(1) await select(1)
clickHandle('Ajouter un sommet après le sommet 1', [72.5, 55]) clickHandle('Ajouter un sommet après le sommet 1 de N', [72.5, 55])
clickHandle('Sommet 2', [72.5, 55]) clickHandle('Sommet 2 de N', [72.5, 55])
clickHandle('Retirer le sommet 2', [72.5, 45]) clickHandle('Retirer le sommet 2 de N', [72.5, 45])
drag(hitOf('Sommet 1'), [55, 55], [60, 60]) drag(hitOf('Sommet 1 de N'), [55, 55], [60, 60])
drag(marker('z'), [80, 80], [85, 85]) drag(marker('z'), [80, 80], [85, 85])
expect(depth()).toBe(4) expect(depth()).toBe(4)
expect(JSON.stringify(annotationOf('p').geometry)).toBe(before) expect(JSON.stringify(annotationOf('p').geometry)).toBe(before)
@@ -710,7 +762,7 @@ describe('fix round 1: no lost series, no lost focus, no stale « − »', () =>
it('M-2: a chosen vertex stamped on another text removes nothing', async () => { it('M-2: a chosen vertex stamped on another text removes nothing', async () => {
await mount(squareText()) await mount(squareText())
await select() await select()
clickHandle('Sommet 2', [80, 20]) clickHandle('Sommet 2 de N', [80, 20])
const before = depth() const before = depth()
act(() => act(() =>
useAnnotationWork.setState({ useAnnotationWork.setState({
@@ -818,7 +870,7 @@ describe('the zoom hint for short segments (R-18, D2)', () => {
await select() await select()
expect( expect(
screen.queryByRole('button', { screen.queryByRole('button', {
name: 'Ajouter un sommet après le sommet 1', name: 'Ajouter un sommet après le sommet 1 de N',
}), }),
).toBeNull() ).toBeNull()
expect(plus(2)).toBeInTheDocument() expect(plus(2)).toBeInTheDocument()
@@ -835,7 +887,7 @@ describe('the zoom hint for short segments (R-18, D2)', () => {
it('a refusal takes its place while shown', async () => { it('a refusal takes its place while shown', async () => {
await mount(squareText(SHORT)) await mount(squareText(SHORT))
await select() await select()
drag(hitOf('Sommet 3'), [80, 20], [500, 20]) drag(hitOf('Sommet 3 de N'), [80, 20], [500, 20])
const notice = screen.getByTestId('edit-strip-notice') const notice = screen.getByTestId('edit-strip-notice')
expect(notice).toHaveTextContent('Déplacement refusé') expect(notice).toHaveTextContent('Déplacement refusé')
expect(notice).not.toHaveTextContent(zoomHint) expect(notice).not.toHaveTextContent(zoomHint)
@@ -1011,7 +1063,7 @@ describe('final review I-1: a redo or a handle key never drops pending work', ()
it('in a started vertex move, Enter on « − », Insert and Delete change nothing', async () => { it('in a started vertex move, Enter on « − », Insert and Delete change nothing', async () => {
await mount(squareText()) await mount(squareText())
await select() await select()
clickHandle('Sommet 3', [80, 80]) clickHandle('Sommet 3 de N', [80, 80])
await startedMove('Déplacer le sommet') await startedMove('Déplacer le sommet')
const before = depth() const before = depth()
fireEvent.keyDown(minus(3), { key: 'Enter' }) fireEvent.keyDown(minus(3), { key: 'Enter' })
@@ -1039,21 +1091,21 @@ describe('final review I-1 audit: a press on the drawing never drops a keyed ser
it('a press on « + »: the step is committed, then the insert', async () => { it('a press on « + »: the step is committed, then the insert', async () => {
const before = await keyed() const before = await keyed()
clickHandle('Ajouter un sommet après le sommet 1', [50.25, 20]) clickHandle('Ajouter un sommet après le sommet 1 de N', [50.25, 20])
expect(pointsOf('z')).toEqual([[20.5, 20], [50.25, 20], ...SQUARE.slice(1)]) expect(pointsOf('z')).toEqual([[20.5, 20], [50.25, 20], ...SQUARE.slice(1)])
expect(depth()).toBe(before + 2) expect(depth()).toBe(before + 2)
}) })
it('a press on « − »: the step is committed, then the removal', async () => { it('a press on « − »: the step is committed, then the removal', async () => {
const before = await keyed([...SQUARE, [10, 50]]) const before = await keyed([...SQUARE, [10, 50]])
clickHandle('Retirer le sommet 1', [20.5, 20]) clickHandle('Retirer le sommet 1 de N', [20.5, 20])
expect(pointsOf('z')).toEqual([...SQUARE.slice(1), [10, 50]]) expect(pointsOf('z')).toEqual([...SQUARE.slice(1), [10, 50]])
expect(depth()).toBe(before + 2) expect(depth()).toBe(before + 2)
}) })
it('a drag of another vertex carries the keyed step', async () => { it('a drag of another vertex carries the keyed step', async () => {
await keyed() await keyed()
drag(hitOf('Sommet 2'), [80, 20], [90, 10]) drag(hitOf('Sommet 2 de N'), [80, 20], [90, 10])
expect(pointsOf('z')).toEqual([[20.5, 20], [90, 10], ...SQUARE.slice(2)]) expect(pointsOf('z')).toEqual([[20.5, 20], [90, 10], ...SQUARE.slice(2)])
}) })
}) })
@@ -1144,7 +1196,7 @@ describe('Safari: a strip command clicked with the focus left on a keyed vertex'
async function keyedVertex() { async function keyedVertex() {
await mount(squareText()) await mount(squareText())
await select() await select()
clickHandle('Sommet 1', [20, 20]) clickHandle('Sommet 1 de N', [20, 20])
act(() => vertex(1).focus()) act(() => vertex(1).focus())
fireEvent.keyDown(vertex(1), { key: 'ArrowRight' }) fireEvent.keyDown(vertex(1), { key: 'ArrowRight' })
expect(useAnnotationWork.getState().preview?.source).toBe('keys') expect(useAnnotationWork.getState().preview?.source).toBe('keys')
+4 -1
View File
@@ -185,7 +185,10 @@ the same layer, in this order: one « + » at the midpoint of each segment
(wrapping from the last vertex to the first), then one vertex handle per (wrapping from the last vertex to the first), then one vertex handle per
vertex, then the « − » bubble of the chosen vertex, a rounded rectangle drawn vertex, then the « − » bubble of the chosen vertex, a rounded rectangle drawn
just above that vertex. Each is a `role="button"` with `tabindex="0"`, so Tab and just above that vertex. Each is a `role="button"` with `tabindex="0"`, so Tab and
Shift+Tab walk them in document order. A « + » is not drawn while its segment Shift+Tab walk them in document order. They sit in one `<g role="group">` named
« Sommets de {nom} »; each name carries the shape's display name in the current
locale: « Sommet {n} de {nom} », « Ajouter un sommet après le sommet {n} de
{nom} », « Retirer le sommet {n} de {nom} ». A « + » is not drawn while its segment
is shorter than two hit radii on screen at the current zoom (R-9); Insert on is shorter than two hit radii on screen at the current zoom (R-9); Insert on
a vertex still reaches it. The « − » bubble is `aria-disabled` and greyed a vertex still reaches it. The « − » bubble is `aria-disabled` and greyed
while the polygon has three vertices. Above 40 vertices (`HANDLE_CAP`, T18) while the polygon has three vertices. Above 40 vertices (`HANDLE_CAP`, T18)
+5 -2
View File
@@ -816,8 +816,11 @@ Interprétations et écarts par rapport aux planches :
de texte gardent leur propre annulation. de texte gardent leur propre annulation.
Libellés inventés pendant la construction (français / anglais) : Libellés inventés pendant la construction (français / anglais) :
- « Sommet {n} » / « Vertex {n} » ; « Ajouter un sommet après le sommet {n} » / « Add a vertex after vertex {n} » ; - « Sommet {n} de {nom} » / « Vertex {n} of {name} » ; « Ajouter un sommet après le sommet {n} de {nom} » /
« Retirer le sommet {n} » / « Remove vertex {n} » (noms des poignées, lus par les lecteurs d'écran). « Add a vertex after vertex {n} of {name} » ; « Retirer le sommet {n} de {nom} » / « Remove vertex {n} of {name} »
(noms des poignées, lus par les lecteurs d'écran ; {nom} est le nom de la zone dans la langue choisie, par exemple
« Sommet 3 de Vertèbres thoraciques ») ; « Sommets de {nom} » / « Vertices of {name} » (nom du groupe des
poignées).
- « Accès {nom} » / « Link {name} » (nom de la poignée d'un accès). - « Accès {nom} » / « Link {name} » (nom de la poignée d'un accès).
- « Sommet déplacé » / « Vertex moved ». - « Sommet déplacé » / « Vertex moved ».
- « Taille refusée : {texte} » / « Size refused: {text} ». - « Taille refusée : {texte} » / « Size refused: {text} ».
+1 -1
View File
@@ -62,7 +62,7 @@ Implemented (plan `.claude/tasks/plans/2026-11-17-v1-2-6-u2.md`, rev 3; boards `
| Layout (A14) | `expectNoShift` (`e2e/support/layout.ts`) at 1 024, 1 180 and 1 280 px: no box of the canvas, the strip, the aside or the header moves, `scrollHeight` and the scrollbar gutter are unchanged, and the layout-shift sum is zero around selection, strip content, a message showing and expiring, the hint, a dialog opening and closing, mode entry and exit, and the first commit's save line; `scrollbar-gutter: stable` on the editor page only (`editor-annotations.spec.ts`) | | Layout (A14) | `expectNoShift` (`e2e/support/layout.ts`) at 1 024, 1 180 and 1 280 px: no box of the canvas, the strip, the aside or the header moves, `scrollHeight` and the scrollbar gutter are unchanged, and the layout-shift sum is zero around selection, strip content, a message showing and expiring, the hint, a dialog opening and closing, mode entry and exit, and the first commit's save line; `scrollbar-gutter: stable` on the editor page only (`editor-annotations.spec.ts`) |
| Keyboard | create a zone, add and remove a vertex, move the zone, validate, without a pointer; Ctrl+Z on a focused handle after arrow moves only cancels the preview and a later Enter commits nothing stale; after undoing « + », « − » never removes the wrong vertex; « Désélectionner » commits a pending series | | Keyboard | create a zone, add and remove a vertex, move the zone, validate, without a pointer; Ctrl+Z on a focused handle after arrow moves only cancels the preview and a later Enter commits nothing stale; after undoing « + », « − » never removes the wrong vertex; « Désélectionner » commits a pending series |
| Paths (T16) | a path annotation gets no handle, no « + » or « − », no zone move in either mode, no keyboard move; its `d` is byte-identical after every gesture on its neighbours, a save and a reload; « Remplacer par un polygone » stays the only change: explicit, validated by the core, the path kept while tracing, on Escape and on a refusal; one undo entry restoring the exact `d`, redo restoring the polygon (owner, BDR-101) | | Paths (T16) | a path annotation gets no handle, no « + » or « − », no zone move in either mode, no keyboard move; its `d` is byte-identical after every gesture on its neighbours, a save and a reload; « Remplacer par un polygone » stays the only change: explicit, validated by the core, the path kept while tracing, on Escape and on a refusal; one undo entry restoring the exact `d`, redo restoring the polygon (owner, BDR-101) |
| Accessibility | axe on selection, tracing, move states and the dialog in read and edit modes; handle names (« Point {nom} », « Sommet {n} », « Ajouter un sommet après le sommet {n} », « Retirer le sommet {n} »); live-region message after a move; WCAG 2.5.7: the move mode with four arrow buttons is the single-pointer path without dragging (A11) | | Accessibility | axe on selection, tracing, move states and the dialog in read and edit modes; handle names (« Point {nom} », « Sommet {n} de {nom} », « Ajouter un sommet après le sommet {n} de {nom} », « Retirer le sommet {n} de {nom} », the handle group « Sommets de {nom} »); live-region message after a move; WCAG 2.5.7: the move mode with four arrow buttons is the single-pointer path without dragging (A11) |
| Performance | commit latency under the 500 ms budget for drag, insert and remove, a measure run by hand at the gates (`e2e/support/measure-commit.ts`, `editor-measure-commit.spec.ts`, `MEASURE_COMMIT=1`) on a run-seeded equine-sized draft, never on the historical copy nor through `editor-equine.spec.ts`. Measured 2026-11-18 on a production build under `vite preview`, Chromium mouse at 1 280 px, CPU ×4, from the release to the painted frame showing the new geometry with the undo entry: median / max drag 176.9 / 209.2 ms, « + » 176.2 / 177.6 ms, « − » 168.2 / 170.3 ms (three runs each; figures in plan Task 10); the drag smoothness is a measure, not an assertion (`e2e/support/measure-drag.ts`, `editor-measure-drag.spec.ts`, run by hand). Measured 2026-11-18 on a production build under `vite preview`, Chromium touch at 1 180 px, CPU ×4: frame work p95 4.2 to 4.7 ms with the loupe (technique A), 4.0 to 4.4 ms outline only (B), 3.6 to 4.2 ms without a loupe; technique A kept. The figures are in plan Task 8; the owner's tablet trial is the real check | | Performance | commit latency under the 500 ms budget for drag, insert and remove, a measure run by hand at the gates (`e2e/support/measure-commit.ts`, `editor-measure-commit.spec.ts`, `MEASURE_COMMIT=1`) on a run-seeded equine-sized draft, never on the historical copy nor through `editor-equine.spec.ts`. Measured 2026-11-18 on a production build under `vite preview`, Chromium mouse at 1 280 px, CPU ×4, from the release to the painted frame showing the new geometry with the undo entry: median / max drag 176.9 / 209.2 ms, « + » 176.2 / 177.6 ms, « − » 168.2 / 170.3 ms (three runs each; figures in plan Task 10); the drag smoothness is a measure, not an assertion (`e2e/support/measure-drag.ts`, `editor-measure-drag.spec.ts`, run by hand). Measured 2026-11-18 on a production build under `vite preview`, Chromium touch at 1 180 px, CPU ×4: frame work p95 4.2 to 4.7 ms with the loupe (technique A), 4.0 to 4.4 ms outline only (B), 3.6 to 4.2 ms without a loupe; technique A kept. The figures are in plan Task 8; the owner's tablet trial is the real check |
## U3 · Category panel and own colour ## U3 · Category panel and own colour