Plates in a rack that you reorder. Each has a knurled handle: drag it and the plate lifts off the rack on a shadow while the others slide aside, or pick it up from the keyboard and walk it up and down. Every step is spoken.
import '/kit/kit.mjs'; // wires every .tui-sortable on the page, now or later
document.querySelector('.tui-sortable').addEventListener('tui-reorder', (e) => {
e.detail.from; // where the plate was
e.detail.to; // where it is now
e.detail.order; // ['team', 'billing', 'security', …]: each data-id
save(e.detail.order);
});
Each handle is a real button with a name (“Move Billing”) and a description that says how to use it. The plate itself is not a drag target, so a tap on its words does nothing surprising.
The keyboard does everything a pointer does. Space picks up, the arrows move, Space drops, Escape puts it back; Home and End go to the ends.
Each step is spoken in an assertive live region with the plate’s name and its place: “Picked up Billing. Position 2 of 5.”
The handle keeps the focus and the pointer capture all the way, because the plates around it are the ones that move.
A picked-up plate is shown by its lit lamp and its lifted shadow, and aria-pressed on its handle says it too.
With reduced motion the others do not slide; they are in their new places at once, and the announcements are the same.
06
How it’s built
A tray cut into the plate with a rack of raised plates in it, each one a key’s cap laid flat. A 4px inset makes the handle’s 4px corner concentric with the plate’s 8px, and a 5px gap makes the tray’s 13px. The handle is a slot with vertical ridges cut across it, each a dark line and a lit one. Dragging moves the plate with a transform that follows the pointer; when its middle passes a neighbour’s, that neighbour is moved around it, which keeps the handle’s focus and capture, and every plate that moved is slid from where it was to where it is (a FLIP, with the Web Animations API). Dropping settles the plate from where the pointer left it. The order is the document’s: nothing is stored in script, and tui-reorder is how you find out.
07
Rules
sortable.rules.mdIn the brain
For an order that means something, like a running order or priorities. Not a column sort.
6 rules in this file, with the foundations they rest on and the anti-patterns that break them. Full rules ship in the brain with the Pass.
Rows in a rack: a mark, a title, a second line and a fact or a key at the end. Chosen rows sink into a recess with their check key latched; in a running order, a row lifts out of the rack on its skirt and slides past the others, from the keyboard or by its grip.
Folders and files as a real tree, printed like a wiring diagram: traces with an elbow into every item, chevrons that turn, and the chosen file set in a recess with its lamp lit. Written as a plain nested list.