focus field input

pull/349/head
Pete Matsyburka 1 year ago
parent 7fc7283191
commit a589cf9471

@ -697,6 +697,7 @@ export default {
isFormVisible: this.expand !== false, isFormVisible: this.expand !== false,
showFillAllRequiredFields: false, showFillAllRequiredFields: false,
currentStep: 0, currentStep: 0,
enableScrollIntoField: true,
phoneVerifiedValues: {}, phoneVerifiedValues: {},
orientation: screen?.orientation?.type, orientation: screen?.orientation?.type,
isSubmitting: false, isSubmitting: false,
@ -992,9 +993,11 @@ export default {
if (!this.isCompleted) { if (!this.isCompleted) {
if (scrollToArea) { if (scrollToArea) {
this.scrollIntoField(step[0]) this.scrollIntoField(step[0])
}
this.enableScrollIntoField = false
this.$refs.form.querySelector('input[type="date"], input[type="number"], input[type="text"], select')?.focus() this.$refs.form.querySelector('input[type="date"], input[type="number"], input[type="text"], select')?.focus()
} this.enableScrollIntoField = true
if (clickUpload && !this.values[this.currentField.uuid] && ['file', 'image'].includes(this.currentField.type)) { if (clickUpload && !this.values[this.currentField.uuid] && ['file', 'image'].includes(this.currentField.type)) {
this.$refs.form.querySelector('input[type="file"]')?.click() this.$refs.form.querySelector('input[type="file"]')?.click()
@ -1028,7 +1031,9 @@ export default {
} }
}, },
scrollIntoField (field) { scrollIntoField (field) {
if (this.enableScrollIntoField) {
return this.$refs.areas.scrollIntoField(field) return this.$refs.areas.scrollIntoField(field)
}
}, },
scrollIntoArea (area) { scrollIntoArea (area) {
return this.$refs.areas.scrollIntoArea(area) return this.$refs.areas.scrollIntoArea(area)

Loading…
Cancel
Save