feat(editor): keep edit-only forms across a width change

Edit-only parts (creation forms, submission note, crop group, annotation
edit body) mount at the first editable render and stay mounted, hidden
and detached from canvases, while read-only. Guards: the viewport hook
commits the focused field before the tier crosses 1 024 px, the route
releases focus left in a hidden part and treats a store out of step as
read-only, delete and discard confirmations close when the editor turns
read-only, a drag is dropped while the edit body is hidden. Read-only
twins take an id prefix.

R-24: no existing assertion rewritten; editor-no-loss.test.tsx and two
editor-shell Chromium cases added.
This commit is contained in:
bchanot committed 2026-11-06 21:22:10 +01:00
1 parent 9d89daed19
commit c57af6441f
23 files changed
+883 -108

No files matched your search

+10
View File
@@ -117,3 +117,13 @@ export function commitFocusedField(): void {
active.blur()
}
}
/**
* The editor turned read-only: commits the text being typed, then releases any focus left
* inside a hidden part, so no field is focused in a place that left the page.
*/
export function releaseEditFocus(): void {
commitFocusedField()
const active = document.activeElement
if (active instanceof HTMLElement && active.closest('[hidden]')) active.blur()
}