From c9c8149d23913ea8b68150afea3d41975d3063a2 Mon Sep 17 00:00:00 2001 From: Andrew Kostka Date: Fri, 19 Jan 2024 08:19:50 +0000 Subject: [PATCH] Scroll to first invalid field on error --- src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue b/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue index 29ed0eac..32077c09 100644 --- a/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue +++ b/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue @@ -140,7 +140,11 @@ export default { } await this.$nextTick() - if (!this.$refs.questyForm.validate()) { + const invalidField = this.$refs.questyForm.$children.find((field) => { + return typeof field.validate === 'function' && !field.validate() + }) + if (invalidField) { + invalidField.$el.scrollIntoView({ behavior: 'smooth' }) return }