Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Autosrolling to focussed field
Kartik Bajaj58751012925d
diff --git a/packages/form/src/ValidatedForm.tsx b/packages/form/src/ValidatedForm.tsxindex b2b700db00..9cf6846253 100644--- a/packages/form/src/ValidatedForm.tsx+++ b/packages/form/src/ValidatedForm.tsx@@ -115,6 +115,27 @@ function nonNull<T>(value: T | null | undefined): value is T {return value !== null;}+const scrollIntoView = (element?: HTMLElement) => {+ if (!element) {+ return;+ }++ // try the container route first as scrollIntoView sometimes have side effects by moving the wrong container+ const container = element.closest(".overflow-hidden > .h-full");+ if (container) {+ // Get the position of the target relative to the container+ const offsetTop = element.offsetTop;++ // Scroll the container only+ container.scrollTo({+ top: offsetTop,+ behavior: "smooth", // use 'auto' if you don't want smooth scrolling+ });+ } else {+ element.scrollIntoView({ behavior: "smooth", block: "center" });+ }+};+const focusFirstInvalidInput = (fieldErrors: FieldErrors,customFocusHandlers: MultiValueMap<string, () => void>,@@ -153,16 +174,19 @@ const focusFirstInvalidInput = (.find((item) => item.value === elem.value) ?? elem[0];if (selectedRadio && selectedRadio instanceof HTMLInputElement) {selectedRadio.focus();+ scrollIntoView(selectedRadio);break;}}if (elem instanceof HTMLElement) {if (elem instanceof HTMLInputElement && elem.type === "hidden") {+ scrollIntoView(elem.parentElement);continue;}elem.focus();+ scrollIntoView(elem);break;}}