(node: FormKitNode, el: Element)
| 456 | } |
| 457 | |
| 458 | function 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 | |
| 479 | function createSSRStepsFromTabs(tabs: Record<string, any>[]) { |
| 480 | if (!tabs || !tabs.length) return [] |
no test coverage detected