@prefecthq/prefect-design
Version:
A collection of low-level Vue components.
17 lines (15 loc) • 369 B
text/typescript
const VALIDATION_ERROR_SELECTORS = [
'.p-label--failed',
'.p-checkbox--failed',
'.p-radio--failed',
'.p-base-input--failed',
]
export function scrollToValidationError(): void {
const error = document.querySelector(VALIDATION_ERROR_SELECTORS.join(', '))
if (error) {
error.scrollIntoView({
behavior: 'smooth',
block: 'nearest',
})
}
}