diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue index 1f3a336e70..a5343d01b1 100644 --- a/packages/nc-gui/components/smartsheet/Form.vue +++ b/packages/nc-gui/components/smartsheet/Form.vue @@ -410,6 +410,12 @@ watch(view, (nextView) => { } }) +watch(activeRow, () => { + if (activeRow.value) { + document.querySelector(`.nc-form-field-list-item-${activeRow.value}`)?.scrollIntoView({ behavior: 'smooth', block: 'center' }) + } +}) + const onFormItemClick = (element: any) => { if (isLocked.value || !isEditable) return @@ -420,7 +426,7 @@ useEventListener(document, 'focusout', (e: FocusEvent) => { const nextActiveFieldTitle = e?.relatedTarget?.getAttribute('data-title') || e?.relatedTarget?.offsetParent?.closest('.nc-form-focus-element')?.getAttribute('data-title') - if (nextActiveFieldTitle && activeRow.value !== nextActiveFieldTitle) { + if (activeRow.value && nextActiveFieldTitle && activeRow.value !== nextActiveFieldTitle) { activeRow.value = nextActiveFieldTitle } }) @@ -755,12 +761,9 @@ useEventListener(document, 'focusout', (e: FocusEvent) => { > { + activeRow = '' } " > @@ -946,8 +949,12 @@ useEventListener(document, 'focusout', (e: FocusEvent) => {