Fix error when trying to scroll to an invalid field
This commit is contained in:
parent
9da641f848
commit
ee452f75fe
|
@ -423,11 +423,15 @@
|
|||
}
|
||||
const fieldId = field.fieldState.fieldId
|
||||
const fieldElement = document.getElementById(fieldId)
|
||||
if (fieldElement) {
|
||||
fieldElement.focus({ preventScroll: true })
|
||||
}
|
||||
const label = document.querySelector(`label[for="${fieldId}"]`)
|
||||
if (label) {
|
||||
label.style.scrollMargin = "100px"
|
||||
label.scrollIntoView({ behavior: "smooth", block: "nearest" })
|
||||
}
|
||||
}
|
||||
|
||||
// Action context to pass to children
|
||||
const actions = [
|
||||
|
|
Loading…
Reference in New Issue