feat(app): Désélectionner and the Escape priority (R1, D6, A5, A6)

« Désélectionner » (secondary sm, deselect glyph) sits left of « Supprimer » in a
bordered row of the properties panel, read-only too, hidden while a tracing runs.
It commits the typed field, clears the selection, focuses the row (else the drawing)
and announces. Escape deselects through one document listener per visible body
(not in a text field, only inside the workspace); G1: row focus only from the panel.
« Plus » and the references panel close first; a tracing cancel marks its Escape.

No existing assertion rewritten.
This commit is contained in:
bchanot committed 2026-11-12 12:45:45 +01:00
1 parent 7dda61d2ae
commit bbb1668406
14 files changed
+633 -42

No files matched your search

+13 -5
View File
@@ -102,6 +102,17 @@ export function useRowFocus(focus: FocusRequest | undefined): void {
)
}
/** A field that takes typed text (or a choice): Escape there belongs to the field. */
export function isTextField(target: EventTarget | null): boolean {
return (
target instanceof HTMLInputElement ||
target instanceof HTMLTextAreaElement ||
target instanceof HTMLSelectElement ||
(target instanceof HTMLElement &&
target.closest('[contenteditable]') !== null)
)
}
/**
* Commits the text being typed before a place is left: blurs the focused field, so its
* `TextField` commits on blur. Safari and iPadOS do not move the focus to a tapped button,
@@ -109,11 +120,8 @@ export function useRowFocus(focus: FocusRequest | undefined): void {
*/
export function commitFocusedField(): boolean {
const active = document.activeElement
const isField =
active instanceof HTMLInputElement ||
active instanceof HTMLTextAreaElement ||
active instanceof HTMLSelectElement
if (isField) active.blur()
const isField = isTextField(active)
if (isField) (active as HTMLElement).blur()
return isField
}