From cb0af4334f364f34abdf2ac65c0d8a93c0d979ad Mon Sep 17 00:00:00 2001 From: Stalwart Git Sync <279488187+stalwart-labs@users.noreply.github.com> Date: Tue, 1 Dec 2026 11:06:15 +0100 Subject: [PATCH] Forms: enable Save while typing and keep the action bar buttons in place --- CHANGELOG.md | 1 + src/components/forms/DynamicForm.tsx | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27f83f4..46b8471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. This projec ### Fixed - Browser auto-translation (Chrome, Edge, Safari) is turned off for the web interface, which crashed with a `removeChild` error when the translator rewrote the page. +- Forms: Save is enabled as soon as a field is edited, without leaving the field first, and the Delete, Cancel and Save buttons no longer move when the "Unsaved changes" label appears. ## [2.1.2] - 2026-11-29 diff --git a/src/components/forms/DynamicForm.tsx b/src/components/forms/DynamicForm.tsx index 30c8fe1..a385ebf 100644 --- a/src/components/forms/DynamicForm.tsx +++ b/src/components/forms/DynamicForm.tsx @@ -155,6 +155,7 @@ export function DynamicForm({ const model = useDynamicForm(viewName, objectId, { accountId, fieldOverrides, createValues, showCreatedValues }); const { schema, resolved, mode, isSingleton, state, isDirty, saving, loading, loadError } = model; const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false); + const [pendingInput, setPendingInput] = useState(false); const title = useFormTitle(model); const sectionPrefix = useId(); const wide = useSyncExternalStore(subscribeWide, isWide, () => false); @@ -165,6 +166,7 @@ export function DynamicForm({ const isCreate = mode === 'create'; const readOnly = !isCreate && !canUpdate; const canDelete = !isCreate && !isSingleton && canDestroy; + const hasChanges = isDirty || pendingInput; const subtitle = (model.parentForm ?? model.variantForm)?.subtitle; const errorText = state.generalError ?? loadError; const header = ( @@ -222,7 +224,15 @@ export function DynamicForm({