Autofocus first field as settings option (#536)

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2024-08-23 15:02:09 +05:30
committed by GitHub
parent 94b3d26672
commit a73badb091
6 changed files with 36 additions and 1 deletions

View File

@@ -185,6 +185,11 @@
label="Auto save form response"
help="Will save data in browser, if user not submit the form then next time will auto prefill last entered data"
/>
<ToggleSwitchInput
name="auto_focus"
:form="form"
label="Auto focus first input on page"
/>
</editor-options-panel>
</template>

View File

@@ -22,6 +22,7 @@ export const initForm = (defaultValue = {}, withDefaultProperties = false) => {
closed_text:
"This form has now been closed by its owner and does not accept submissions anymore.",
auto_save: true,
auto_focus: true,
border_radius: 'small',
size: 'md',

View File

@@ -161,7 +161,7 @@ onMounted(() => {
console.error('Error appending custom code', e)
}
}
if (!isIframe) focusOnFirstFormElement()
if (!isIframe && form.value?.auto_focus) focusOnFirstFormElement()
}
}
})