form-graph
    Preparing search index...

    Function focusFirstError

    • Focuses the first errored field, in DECLARATION order (snapshot.keys), by the data-fg-field attribute the bindings' fieldProps render — call it after a failed validate(), when refine errors are surfaced:

      const result = store.validate(step.keys); if (!result.success) focusFirstError(store, step.keys);

      keys limits the search to a scope (a wizard step); a LIST key covers its elements, mirroring scoped validate. SSR-safe and never throws: no document, or nothing focusable for any errored key, is false. An errored key whose element is missing OR not actually focusable (spread onto a div) doesn't stop the search — a later errored field may be the one on screen.

      Parameters

      Returns boolean