Primitives / Interaction

foldkit-primitives/interaction

Keyboard, pointer, and focus patterns whose state a view's slots must reflect: which item holds the tab stop, what the user has typed to find, whether a button is pressed, which overlays are open, what is selected. Each is a Bundle that keeps that state in the Model and a matching foldkit-mixins Behavior that writes the attributes and handlers onto the view's slots. Importing this subpath needs foldkit-mixins; the other subpaths do not. (source)

place the Bundle          →  the Model holds the fact (current id, query, pressed, …)
attach its Behavior       →  the slots get tabindex, aria-*, data-*, and key handlers
the handler dispatches    →  update moves the fact; the view redraws from it
NameKeeps in the ModelFor
RovingTabindex{ current }one tab stop for a set of items, arrows between them
Typeahead{ query, generation }type-to-find, for a host whose focus is managed elsewhere
ListNavigation{ current, query, generation }a list host that wants both, in one placement
GridNavigation{ current }cells in rows: a calendar, a swatch picker
SpatialNavigation{ current }freely placed items: a board, a canvas, a dashboard of cards
TreeNavigation{ current, toggled }a tree: a file explorer, a layers panel
FocusScopenothing (a Mount)keep focus inside an overlay
FocusRecoverynothing (a Mount)keep focus when its part is removed or hidden
InlineEdit{ editing }; out Committededit a plain value where it is shown, in an <input>
Presencenothing (draws the Model's phase)a leaving row that takes no click, Tab or focus
Press{ pressed, … }; out Pressedpointer, touch, Enter, Space, and AT clicks as one fact
LongPress{ … }; out LongPressedholding for a threshold
SwipeActions{ open }; out FullSwipedwhich side of a row is open, what a swipe's release means, and its keys
Repeat{ holding, count, … }; out Stepped, Endeda held stepper button
Movenothing (a Mount)pointer drag deltas
Targetsnothing (a Mount)which marked descendant is hovered or pressed
PointerDragnothing (a Mount)dragging one marked descendant onto another
Marqueenothing (a Mount)a lasso over the marked descendants, from a press on empty space
Reorder{ held, over }; out Moved, PickedUp, PassedOver, PutBackmoving an item in a list or tree, by keys and by pointer
EditableTextnothing (a Mount)text typed into a contenteditable field
FocusVisibleInputModality's { modality }a focus ring for keyboard users only
DismissLayer{ layers }; out Dismiss { ids }close overlays on Escape or an outside press
Layersnothing (Mounts)scroll lock and inert-outside for an overlay
Selection{ selected, anchor, ranged }selected items with aria-selected and Shift ranges
LiveAnnouncethe live regions' textspeak to assistive technology
Overlay, Placingnothing (Behaviors)one policy for an overlay's dismissal, focus and locks; keep a panel in the viewport
BundleBehaviornothingwrite the Behavior half of a Bundle you author

The pure rule behind each (move, match, nearest, between, toDismiss, targetOf, zoneOf) is exported beside it, for a view that wires its own.