From 8bfd3591a624ad7b77bcd9d3c38961a1ba59f23c Mon Sep 17 00:00:00 2001 From: kevin olson Date: Sat, 14 Oct 2023 09:12:39 -0500 Subject: [PATCH] feat(Input/Textarea): allow specifying autofocus delay for page transitions (#816) --- src/runtime/components/forms/Input.vue | 6 +++++- src/runtime/components/forms/Textarea.vue | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/runtime/components/forms/Input.vue b/src/runtime/components/forms/Input.vue index 537de062..fdaadad9 100644 --- a/src/runtime/components/forms/Input.vue +++ b/src/runtime/components/forms/Input.vue @@ -85,6 +85,10 @@ export default defineComponent({ type: Boolean, default: false }, + autofocusDelay: { + type: Number, + default: 100, + }, icon: { type: String, default: null @@ -181,7 +185,7 @@ export default defineComponent({ onMounted(() => { setTimeout(() => { autoFocus() - }, 100) + }, props.autofocusDelay) }) const inputClass = computed(() => { diff --git a/src/runtime/components/forms/Textarea.vue b/src/runtime/components/forms/Textarea.vue index ec2cff97..54cc838b 100644 --- a/src/runtime/components/forms/Textarea.vue +++ b/src/runtime/components/forms/Textarea.vue @@ -72,6 +72,10 @@ export default defineComponent({ type: Boolean, default: false }, + autofocusDelay: { + type: Number, + default: 100 + }, resize: { type: Boolean, default: false @@ -168,7 +172,7 @@ export default defineComponent({ onMounted(() => { setTimeout(() => { autoFocus() - }, 100) + }, props.autofocusDelay) }) watch(() => props.modelValue, () => {