diff --git a/apps/app/e2e/shell/editor-annotations.spec.ts b/apps/app/e2e/shell/editor-annotations.spec.ts index ffc5866e..3517ced6 100644 --- a/apps/app/e2e/shell/editor-annotations.spec.ts +++ b/apps/app/e2e/shell/editor-annotations.spec.ts @@ -416,6 +416,30 @@ test.describe('editor annotations (A3)', () => { .first() .evaluate((span) => span.scrollWidth > span.clientWidth) expect(cut, 'the message is cut short').toBe(false) + // M-5: « Défaire » answers 44 px tall below xl (36 px from xl), the pill unchanged. + const reach = width < 1280 ? 44 : 36 + const hit = await line(page) + .getByRole('button', { name: dict['editor.history.undo_title'] }) + .evaluate( + (button, half) => { + const box = button.getBoundingClientRect() + const x = box.left + box.width / 2 + const mid = box.top + box.height / 2 + const at = (dy: number) => document.elementFromPoint(x, mid + dy) + const pill = button.closest('[data-testid="gesture-message"]')! + return { + top: at(-half) === button, + bottom: at(half) === button, + pill: pill.getBoundingClientRect().height, + } + }, + reach / 2 - 1, + ) + expect(hit, `a ${reach} px hit area at ${width} px`).toEqual({ + top: true, + bottom: true, + pill: 36, + }) // Its expiry, 6 s later. await expectNoShift(page, async () => { await page.clock.fastForward(6_100) diff --git a/apps/app/src/components/editor/annotations/EditStrip.tsx b/apps/app/src/components/editor/annotations/EditStrip.tsx index 0e0129d0..90f14d6c 100644 --- a/apps/app/src/components/editor/annotations/EditStrip.tsx +++ b/apps/app/src/components/editor/annotations/EditStrip.tsx @@ -42,12 +42,12 @@ export default function EditStrip({ className="flex h-16 items-center gap-3 overflow-hidden rounded-xl border border-[var(--color-border)] bg-[var(--color-surface)] px-3" > -
- {notice && } +
+ {/* M-3: the polite region always mounted; an alert beside it, never inside. */} +
+ {notice && !alerts(notice) && } +
+ {notice && alerts(notice) && }
{commands} @@ -91,11 +91,14 @@ function Lead({ lead }: { lead: StripLead }) { ) } +/** A refusal not already announced by the gesture line. */ +const alerts = (notice: StripNotice) => notice.tone === 'error' && !notice.quiet + function Notice({ notice }: { notice: StripNotice }) { const error = notice.tone === 'error' return (

{children}

- +
+ {message && !error && ( + + )} +
+ {message && error && ( + + )}
) } -function Message({ messages }: { messages: GestureMessages }) { +/** + * One pill. Each message is another pill (keyed by its serial): a wider one replacing it + * moves no box (A14), and a repeated refusal is announced again (M-3). + */ +function Message({ + messages, + shown, +}: { + messages: GestureMessages + shown: Shown +}) { const t = useT() const readOnly = useEditorReadOnly() // A12: « Défaire » is hidden during a creation; the message itself stays. const creating = useAnnotationWork((s) => s.creation !== null) - const { message, hold } = messages - if (!message) return null - const error = message.tone === 'error' - const { stamp } = message + const error = shown.tone === 'error' return (

- - {message.text} + + {shown.text} - {message.undo && !error && !creating && ( + {shown.undo && !error && !creating && ( <>