srcdev-nuxt-forms 2.1.46 → 2.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@
18
18
  ref="inputField"
19
19
  :aria-checked="isChecked"
20
20
  :aria-describedby
21
+ :aria-invalid="fieldHasError"
21
22
  />
22
23
  </div>
23
24
  </template>
@@ -112,11 +112,14 @@ const useZodValidation = (formSchema: any, formRef: Ref<HTMLFormElement | null>)
112
112
  const scrollToFirstError = async () => {
113
113
  if (formRef.value) {
114
114
  const firstErrorElement = formRef.value.querySelector('[aria-invalid=true]');
115
- window.scrollTo({
116
- top: firstErrorElement?.getBoundingClientRect().y,
117
- left: 0,
118
- behavior: 'smooth',
119
- });
115
+
116
+ if (firstErrorElement) {
117
+ window.scrollTo({
118
+ top: firstErrorElement?.getBoundingClientRect().y + window.scrollY,
119
+ left: 0,
120
+ behavior: 'smooth',
121
+ });
122
+ }
120
123
  }
121
124
  };
122
125
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-forms",
3
3
  "type": "module",
4
- "version": "2.1.46",
4
+ "version": "2.1.47",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",