Focusable role="separator" that resizes a primary pane.
HTML is the source of truth for ARIA attributes; the library
positions the separator and updates the primary pane (or emits events only).
Pattern reference: W3C Window Splitter Pattern.
import WindowSplitter from '@19h47/windowsplitter';
const splitter = new WindowSplitter(document.querySelector('[role="separator"]'));
splitter.init();
mode: 'resize')Drag the separator or use arrow keys. Enter collapses / restores the primary pane.
Primary pane - sized by the splitter value.
Secondary pane fills the remaining space.
aria-orientation="horizontal")Same controller: Up / Down arrows move the bar, Enter collapses the primary (top) pane.
Primary pane - height follows the splitter value.
Secondary pane fills the remaining space below.
mode: 'clip')Overlay two layers and clip the primary (before) pane - same idea as a before/after image slider.
Arrow keys are ignored. Enter toggles between collapsed and the previous position.
| Key | Function |
|---|---|
| Left / Right | Move a vertical splitter |
| Up / Down | Move a horizontal splitter |
| Enter | Collapse or restore the primary pane |
| Home / End | Jump to min / max |
| Page Up / Page Down | Move by page |