improvement scroll to section & focus in create
Deploy app frontend / app frontend (push) Successful in 1m36s

This commit is contained in:
2024-12-09 09:51:04 +02:00
parent 674439646e
commit 7d49c3e8bc
@@ -16,13 +16,14 @@ watch(
() => sectionRef.value && props.isNextActiveSection, () => sectionRef.value && props.isNextActiveSection,
(isNextActiveSection) => { (isNextActiveSection) => {
if (isNextActiveSection) { if (isNextActiveSection) {
sectionRef.value?.scrollIntoView({ behavior: 'smooth', block: 'center' }) const isSM = window.matchMedia('(min-width: 640px)').matches
sectionRef.value?.scrollIntoView({ behavior: 'smooth', block: isSM ? 'center' : 'start' })
const input = sectionRef.value?.querySelector('input[type="text"]') const input = sectionRef.value?.querySelector('input[type="text"][value=""]')
if (input instanceof HTMLInputElement) { if (input instanceof HTMLInputElement) {
setTimeout(() => { setTimeout(() => {
input.focus() input.focus()
}, 200) }, 400)
} }
} }
}, },