MCPcopy Create free account
hub / github.com/formkit/formkit / initEvents

Function initEvents

packages/addons/src/plugins/multiStep/multiStepPlugin.ts:458–477  ·  view source on GitHub ↗
(node: FormKitNode, el: Element)

Source from the content-addressed store, hash-verified

456}
457
458function initEvents(node: FormKitNode, el: Element) {
459 if (!(el instanceof HTMLElement)) return
460 el.addEventListener('keydown', (event: KeyboardEvent) => {
461 if (event.target instanceof HTMLButtonElement) {
462 if (
463 event.key === 'Tab' &&
464 'data-next' in event.target?.attributes &&
465 !event.shiftKey
466 ) {
467 event.preventDefault()
468 const activeStepContext = node.children.find(
469 (step) => !isPlaceholder(step) && step.name === node.props.activeStep
470 ) as FormKitNode | undefined
471 if (activeStepContext && activeStepContext.context) {
472 incrementStep(1, activeStepContext.context)
473 }
474 }
475 }
476 })
477}
478
479function createSSRStepsFromTabs(tabs: Record<string, any>[]) {
480 if (!tabs || !tabs.length) return []

Callers 1

multiStepPluginFunction · 0.85

Calls 2

isPlaceholderFunction · 0.90
incrementStepFunction · 0.85

Tested by

no test coverage detected