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

@@ -37,6 +37,8 @@ export interface PropertiesPanelProps {
dispatch: Dispatch<UiAction>
context: CommitContext
navigate: EditorPlaceProps['navigate']
/** Put before every id, for a twin of the panel that lives beside another one. */
idPrefix?: string
}
/** What still names this annotation as invalid: never hidden, never shown as valid. */
@@ -73,6 +75,7 @@ export default function PropertiesPanel(props: PropertiesPanelProps) {
doc={doc}
readOnly={readOnly}
edit={edit}
idPrefix={props.idPrefix}
/>
<GeometrySection {...props} />
<StatusActions annotation={annotation} readOnly={readOnly} edit={edit} />
@@ -94,7 +97,7 @@ function GeometrySection(props: PropertiesPanelProps) {
{isEditable(geometry) ? (
<GeometryGroup
key={annotation.id}
idPrefix="annotation"
idPrefix={`${props.idPrefix ?? ''}annotation`}
geometry={geometry}
locked={locked}
onApply={(next) => applyGeometry(annotation, next, props.context)}