Composition / foldkit-mixins-builder

The keyboard and the pointer

Five Behaviors from foldkit-primitives wire keyboard and pointer interactions:

WhereBehaviorWhat it handles
tree, rowTreeNavigationArrow, Home, and End focus movement; Right/Left expand or collapse rows
layers, canvaskeyPressedAlt+Arrow moves; Mod+D duplicates; Delete removes; Mod+Z/Y undo/redo; Escape clears
canvasTargetsHover marking and click-to-select without following links
canvasEditableTextDouble-click or Enter edits text fields inline; Enter commits; Escape cancels
layers, canvasKeepInViewScrolls newly selected rows and canvas nodes into view
tree, canvasPointerDrag4px drag (400ms hold on touch) moves nodes before, inside, or after targets
nodeHandleGripPlaceSwitches handle to data-grip-place="inside" when top space is tight
nodeHandlePointerDragGrip drags the selected node; tap or click opens nodeMenu popover
dragPreviewDragPreviewRenders floating drag preview following --fk-drag-x / --fk-drag-y
palettePointerDragDrags Block tiles onto canvas or layer rows; clicks insert at selection

Key interaction details:

  • Shortcuts scope: keyboard shortcuts attach to layers and canvas, keeping Delete inside inspector inputs for text editing. All action buttons, toolbar items, and shortcut hints read PageBuilder.commands and format keys for BuilderView.inputs({ platform: 'mac' }).
  • Grip and touch menu: GripPlace checks scrolling ancestors' scroll-padding-top so sticky headers never cover nodeGrip. Clicking nodeGrip opens the nodeMenu popover (keep nodeMenu hidden when closed and set display only for open state).
  • Drag preview and drops: DragPreview renders in the top layer with aria-hidden and CSS custom properties --fk-drag-x and --fk-drag-y so pointer moves avoid re-rendering. Dropping on a palette tile's target inserts a new Block (catalog patterns insert on press).
  • Announcements: structural edits announce changes (such as "Moved Heading, 2 of 3 in Section body") inside the live region using the Builder's words.