Handsontable editor dev

From handsontable/handsontable · View interactive version

Handsontable editor dev is an AI agent skill from the GitHub repository handsontable/handsontable. Use when creating or modifying a Handsontable cell editor - covers the editor lifecycle state machine (VIRGIN/EDITING/WAITING/FINISHED), DOM management, focus handling, positioning with getEditedCellRect, and validation integration

How to use this skill

Skill file

Handsontable Editor Development

Editor state machine

Four states: VIRGIN (never opened), EDITING (visible, accepting input), WAITING (editing finished, awaiting async validation), FINISHED (validation complete, editor closed). Move through the states in order: never skip one (VIRGIN straight to FINISHED, or past WAITING on async validation), and go backwards only through a full reset.

File structure

src/editors/{editorName}/
  {editorName}.ts    # Main class extending BaseEditor
  index.ts           # Re-exports

Registry: src/editors/registry.ts. Factory: src/editors/factory.ts.

A new registered editor also needs its entry in src/editors/features.json (editor:<name_in_snake_case>, licensing: "none"; copy a neighbor), and a cell type that uses it lists it in its requires.allOf. The unit suite fails until both exist. Run npm run generate:feature-manifest --prefix handsontable and commit what it writes. Rules: src/featureManifest/AGENTS.md.

Lifecycle methods (required overrides)

| Method | Purpose |

|--------|---------|

| init() | Create DOM elements, set up event listeners. |

| prepare() | Called before editing starts. Receives row, col, prop, TD, cellProperties. |

| getValue() | Return the current editor value. |

| setValue(newValue) | Set the editor value (called before open). |

| open() | Show the editor, position it, capture focus. |

| close() | Hide the editor, release focus. |

| focus() | Set focus to the editor's input element. |

| beginEditing() | Start the editing process (calls prepare, setValue, open). |

| finishEditing() | End editing, trigger validation, close if valid. |

Key patterns

Reference implementations: src/editors/textEditor/textEditor.ts (textarea), src/editors/selectEditor/selectEditor.ts (dropdown), src/editors/baseEditor/baseEditor.ts (lifecycle and state transitions).

IME gotcha

For CJK, compositionstart/compositionend timing affects when the value can be read. Read or commit the value only outside a composition (between the events it is intermediate). BaseEditor handles this; custom editors that override key event handling must respect composition state.

Dropdown lists are positioned `fixed` (#8688)

The list of the handsontable, autocomplete, dropdown, and multiselect editors stays a DOM child of the grid root (focus, ARIA, outside-click detection untouched) but is position: fixed, so the root's overflow: clip (any sized height) and scrolling ancestors cannot cut it. Traps:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.