Reordering

A list ordered by hand: a drag handle and a pair of move buttons on every row, the app's rules for where a row may go, and one move handed over each time; and a board, whose cards move between its columns.

API Reorder Board List Table

Every row of a list ordered by hand has a drag handle and a pair of move buttons. Neither one replaces the other.

  • Push to phone2 devices
  • Emailalice@example.com
  • Chat webhookhooks.example
  • SMS+1 555 0100
  • Desktop notificationThis browser

Where a notification goes, tried from the top. Drag a row by its grip, or press its ↑ or ↓; with the focus anywhere in a row, Alt+↑ and Alt+↓ (⌥ on a Mac) do what its buttons do. The other rows make room while one is dragged, and slide to their new places after a press.

When to order by hand#

Give a list a hand-set order when the order means something only its owner knows: what to try first, which rule matches before which, which way a fallback runs. A list that follows a field, a date or a name, is sorted by that field, and its rows carry no handle.

The handle and the buttons#

The handle is for the pointer: it carries a row any distance in one gesture. The buttons are for everyone else: the keyboard, a screen reader, a phone held in one hand, and anyone moving a row by a place or two. Each button's tooltip names its key, so the keyboard shortcut is found where the action already is.

  • Urgent
  • Waiting
  • Someday
Do

Give every row both: the grip at its start, the pair at its end.

  • Urgent
  • Waiting
  • Someday
Don't

Leave the buttons out. A drag is the only way to move these rows, which a keyboard, a screen reader and an unsteady hand cannot make (WCAG 2.5.7).

Do not repeat the buttons as Move up and Move down in the row's ⋯ menu: they are already on the row. Where a row has a menu of its own, the pair goes just before it. A row that is a link keeps the handle and the buttons beside the link, never inside it.

Where a row may go#

MatchUpstreamRuleOrder
/api/*api-poolRate limit 100/min
/static/*cdnCache 1 day
/admin/*adminSign-in required
/docs/*docs.exampleRedirect
/*webEverything else

Routes, matched from the top. The catch-all must stay last: it never moves, and no route may go below it.

  • A row that cannot move stays in the list, its handle and buttons disabled: canMove.
  • A place that cannot take a row is refused before the drop, not undone after it: canDrop. A drag then holds the gap at the nearest place that takes the row, and a button steps past the refused places to the next one that does, or is disabled when there is none.
  • When the rules are costly to ask or the list is long, answer for the buttons at once with canMoveUp and canMoveDown, rather than leaving Reorder to ask canDrop place by place.

onMove hears one move for each drag and each press: the row, where it was and where it went. An app that keeps positions on a server sends that one change; one that keeps an array passes it to moveItem, or moveInGroups for groups. Reorder changes nothing itself.

Groups#

Notify first

  • Push to phone
  • Email

If nobody answers

  • Chat webhook
  • SMS
  • Desktop notification

Paused

No channels

    When the group a row is in is part of its order, as which channels are tried first, put every group in one Reorder with groups, each group a ReorderGroup holding its heading and its rows. A row then moves across: a drag carries it past a heading, and a button at a group's end steps into the next group. Here Notify first takes at most two channels. An empty group shows a line saying so, which a row dragged into it covers.

    When the group is something else about the row, its owner or its state, give each group a Reorder of its own: a row moves only within its group, and changing the group is an edit of the row, from its menu or its form.

    Boards#

    When the group a thing is in is the stage it moves through, a review's or a task's status, and the reader works across the stages at once, lay them side by side as a Board: a BoardColumn for each stage, its cards in BoardCards, each card a BoardCard. The board fills a pane. Its columns are lanes sunk through the pane to the page's ground, and its cards stand in them as modules stand on the ground (Surfaces). A handful of columns at most; more is a table with a status column.

    • A card moves whole. It has no handle: a pointer drags it from anywhere but its controls, and a click that barely moves is still a click. With the focus on its link, Alt and ← or → (⌥ on a Mac) moves it a column over, Alt and ↑ or ↓ a place up or down. A drag is never the only way: give each card a way to move without one, a Move to in a ⋯ menu drawn on every card in BoardCardActions, or its status in its details (WCAG 2.5.7). A card its Move to sends to another column takes the focus with it, on its link.
    • Ticked cards go together. A BoardCardSelect ticks a card, and Shift ticks the run from the last one ticked, in the board's order. Grab one ticked card and the rest come with it, stacked under it; the bar that acts on a list's selection acts on the board's.
    • A drag from a box ticks every card it crosses. Press a card's box and drag across other cards, into the next column too: each one the pointer passes is ticked, or unticked when the first box was ticked. A drag from the card's body still moves the card. Held at a column's foot the column scrolls on, and at the board's end the board does.
    • Its title is a link. BoardCardLink takes a click anywhere on the card. One handled in place, the details beside the board, keeps its href for a middle click, and the card whose details are open is current.
    • What a move changes. A move to another column changes the card's stage, a field like any other: say so as a change to that field is said, with Undo when it is one the page can take back. A move within its column changes the order alone, which moving it back undoes. A column a field orders has no such move.
    • A column a field orders keeps that order. When a column follows a field, the latest change first or the date a card is due, the reader cannot order its cards, as a list that follows a field is sorted by it and its rows carry no handle. Give the column landsAt, and a card moved into it lands there: a drag into it opens that place wherever the pointer is, and scrolls the column to it once the drag rests there. A drag within it, and Alt with ↑ or ↓, leave the card where it is.

    onMove hears each drop and each key press that moves a card, once: the cards, in the board's order, and the column and index they land at, counting the cards that stay; into a column a field orders, the index is its landsAt. moveCards applies it to an array of columns.

    A column read a page at a time ends in Load more (Loading, empty and error). Put it in a BoardCardsFooter, which keeps it at the foot of the cards while a card is dragged over them. A column hundreds of cards long draws only the cards near its view: lay out the rows useBoardRows gives, draw the place a drag opens as a BoardPlaceholder, and give BoardCards a scrollToRow, through which a card moved where nothing is drawn still takes the focus.

    Filtering and saving#

    • While a filter or a search hides some rows, draw no handles and no buttons: a place between rows the reader cannot see means nothing.
    • Save a move as the page saves any other change: at once, or with the form's Save. Do not ask first, and do not toast it with Undo: moving the row back is the undo.

    On each platform#

    • Pointer. Drag the handle; press the buttons, or Alt+↑ and Alt+↓ from anywhere in the row. The handle is no Tab stop: the keyboard has the buttons.
    • Touch. A finger on the handle drags the row at once, with no long press; a finger anywhere else on the row scrolls the page. The buttons keep their size, take hit areas, and stand far enough apart that a thumb meant for one never presses the other. A board's card has no handle: a finger held still on it lifts it, and one that moves at once scrolls the board. Its box to tick shows throughout, as there is no hover to bring it out, and a finger drawn across the boxes scrolls the board rather than ticking them.

    In the demos