mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-04-19 22:37:14 -04:00
* refactor: scroll to first error when submitting a form * refactor: split file browsers into dedicated components with base * chore: pr feedbacks
11 lines
297 B
TypeScript
11 lines
297 B
TypeScript
import { useCallback } from "react";
|
|
|
|
export function useScrollToFormError() {
|
|
return useCallback(() => {
|
|
setTimeout(() => {
|
|
const firstError = document.querySelector("[data-slot='form-message']");
|
|
firstError?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
}, 50);
|
|
}, []);
|
|
}
|