File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -230,12 +230,10 @@ export function formEnhance<T extends AnyZodObject, M>(
230230 ? ( document . querySelector ( options . stickyNavbar ) as HTMLElement )
231231 : null ;
232232
233- if ( ! isElementInViewport ( el , nav ?. offsetHeight ?? 0 ) ) {
234- if ( typeof options . scrollToError == 'string' ) {
235- scrollToAndCenter ( el , undefined , options . scrollToError ) ;
236- } else {
237- el . scrollIntoView ( options . scrollToError ) ;
238- }
233+ if ( typeof options . scrollToError != 'string' ) {
234+ el . scrollIntoView ( options . scrollToError ) ;
235+ } else if ( ! isElementInViewport ( el , nav ?. offsetHeight ?? 0 ) ) {
236+ scrollToAndCenter ( el , undefined , options . scrollToError ) ;
239237 }
240238
241239 // Don't focus on the element if on mobile, it will open the keyboard
You can’t perform that action at this time.
0 commit comments