A drag-and-drop demo looks finished the moment the cards move under the mouse. Then somebody presses Tab. What does the page do for a person who never touches a pointer, or who can click but can't drag?
TL;DR:
@dnd-kit/react0.5.3 gives you keyboard dragging and a live region out of the box. Its defaults also name raw ids, stay silent when you move back a step, and leave focus on<body>mid-drag. All three are fixable. Keep move up and move down buttons, because a drag handle alone fails WCAG 2.5.7.
I built the same five-item list several ways in React and TypeScript, tested each one in headless Chromium, and read back document.activeElement, the live region text, the final order and a render counter on every row. The versions were react and react-dom 19.3.1, typescript 7.0.2 under strict, esbuild 0.28.2, Playwright 1.65.1 with Chromium 159, and Node 22.23.5 on an Apple M1. Five full runs gave the same focus, text, order and render counts. Only the millisecond timings moved.
Which dnd-kit package should you install?
There are two families on npm, and tutorials mix them freely. Here's what the registry said on 2026-11-29.
| Package | npm latest | Published |
|---|---|---|
@dnd-kit/react | 0.5.3 | 2026-10-31 |
@dnd-kit/dom, @dnd-kit/helpers | 0.5.3 | 2026-10-31 |
@dnd-kit/core | 6.3.1 | 2024-12-05 |
@dnd-kit/sortable | 10.0.0 | 2024-12-04 |
The newer line is built around DragDropProvider and useSortable from @dnd-kit/react/sortable. The React quickstart documents it, the older docs sit behind a "Legacy" switch, and there's a migration guide from core. None of the pages I opened calls core deprecated, and none promises a stable API for react. A 0.x version number means you pin exactly and read the changelog before every bump.
My pick for a new project is @dnd-kit/react with exact pins. That's debatable, and the byte table further down is the best argument against it.
One compile trap on the old side: with @types/react 19.3.3 and skipLibCheck: false, tsc 7.0.2 printed seven TS2503 errors, "Cannot find namespace 'JSX'", all from the type files of @dnd-kit/core and @dnd-kit/sortable. The React 19 upgrade guide moved that namespace to React.JSX. With skipLibCheck: true the same sources compiled cleanly.
The working list: handle, buttons and move
npm install @dnd-kit/react@0.5.3 @dnd-kit/dom@0.5.3 @dnd-kit/helpers@0.5.3
This is the component I'd ship. The drag handle is a real <button>, the two move buttons sit beside it, and a visually hidden status paragraph (the sr-only class, which Tailwind ships) reports button moves.
import { move } from '@dnd-kit/helpers';
import { DragDropProvider } from '@dnd-kit/react';
import { useSortable } from '@dnd-kit/react/sortable';
import { useState } from 'react';
import { withAnnouncements } from './announcements';
import { keepHandleFocused } from './keep-handle-focused';
export interface Task {
id: string;
label: string;
}
function Row({ task, index, total, onMove }: {
task: Task;
index: number;
total: number;
onMove: (index: number, step: -1 | 1) => void;
}) {
const { ref, handleRef } = useSortable({
id: task.id,
index,
data: { label: task.label, total },
});
return (
<li ref={ref}>
<button type="button" ref={handleRef} aria-label={`Reorder ${task.label}`}>
::
</button>
<span>{task.label}</span>
<button type="button" aria-label={`Move ${task.label} up`} aria-disabled={index === 0} onClick={() => onMove(index, -1)}>
Up
</button>
<button type="button" aria-label={`Move ${task.label} down`} aria-disabled={index === total - 1} onClick={() => onMove(index, 1)}>
Down
</button>
</li>
);
}
export function SortableTasks({ initial }: { initial: Task[] }) {
const [tasks, setTasks] = useState(initial);
const [status, setStatus] = useState('');
const onMove = (index: number, step: -1 | 1) => {
const target = index + step;
const next = tasks.slice();
const [task] = next.splice(index, 1);
if (!task || target < 0 || target >= tasks.length) {
return;
}
next.splice(target, 0, task);
setTasks(next);
setStatus(`${task.label} moved to position ${target + 1} of ${tasks.length}.`);
};
return (
<DragDropProvider
plugins={withAnnouncements}
onDragOver={keepHandleFocused}
onDragEnd={(event) => setTasks((current) => move(current, event))}
>
<ol>
{tasks.map((task, index) => (
<Row key={task.id} task={task} index={index} total={tasks.length} onMove={onMove} />
))}
</ol>
<p role="status" aria-live="polite" className="sr-only">
{status}
</p>
</DragDropProvider>
);
}
useSortable needs an id and an index. handleRef limits dragging to the button, and data carries the label for the announcements. The move helper returns the new array, or the old one if the drag was canceled. I ran a mixed sequence of keyboard drags, pointer drags, button clicks and one cancel, and the DOM order matched React state after every step.
The two imports from ./ come next.
What does the live region say by default?
The Accessibility plugin is on by default. In the browser it added a role="status" region with aria-live="polite" and aria-atomic="true", present before any drag started, which is what MDN's live region guide asks for. It also gave each handle aria-roledescription="draggable" and an aria-describedby pointing at hidden instructions. Chromium's accessibility tree exposed that text as the button's description, along with a pressed state of false.
The text is where it gets thin. This is one keyboard drag of the first item: pick up, down twice, up once, drop.
| Key | Library defaults | Custom strings |
|---|---|---|
| Space | Picked up draggable item t1. | Picked up Write draft, position 1 of 5. |
| ArrowDown | Draggable item t1 was moved over droppable target t2. | Write draft moved to position 2 of 5. |
| ArrowDown | Draggable item t1 was moved over droppable target t3. | Write draft moved to position 3 of 5. |
| ArrowUp | no new text | Write draft moved to position 2 of 5. |
| Space | Draggable item t1 was dropped over droppable target t1 | Dropped Write draft, position 2 of 5. |
Look at the last two default rows. Moving back up swaps with the same neighbor as the move before, so the sentence is identical, and the plugin only writes the region when the string changes. The DOM gets nothing. And the drop message says the item landed on itself, because optimistic sorting sets the drop target to the drag source. Ids make it worse: in a real app t1 is a UUID.
Positions fix all three. Here's the whole announcements.ts.
import { Accessibility, type DragDropManagerInput } from '@dnd-kit/dom';
import { isSortable } from '@dnd-kit/react/sortable';
// Accessibility.configure() does not type its callbacks, so borrow the option type.
type Announcements = NonNullable<ConstructorParameters<typeof Accessibility>[1]>['announcements'];
const describe = (label: unknown, index: number, total: unknown) => `${label}, position ${index + 1} of ${total}`;
const announcements: Announcements = {
dragstart({ operation: { source } }) {
if (!isSortable(source)) {
return undefined;
}
return `Picked up ${describe(source.data.label, source.index, source.data.total)}.`;
},
dragover({ operation: { source, target } }) {
// After the optimistic sort the target is the source itself. Skip it.
if (!isSortable(source) || !isSortable(target) || source.id === target.id) {
return undefined;
}
return `${source.data.label} moved to position ${target.index + 1} of ${source.data.total}.`;
},
dragend({ operation: { source }, canceled }) {
if (!isSortable(source)) {
return undefined;
}
if (canceled) {
return `Cancelled. ${source.data.label} is back at position ${source.initialIndex + 1} of ${source.data.total}.`;
}
return `Dropped ${describe(source.data.label, source.index, source.data.total)}.`;
},
};
const accessibility = Accessibility.configure({
announcements,
screenReaderInstructions: {
draggable:
'Press space or enter to pick up. Use the up and down arrow keys to move. Press space, enter or tab to drop, or escape to cancel. The move up and move down buttons do the same job.',
},
});
export const withAnnouncements: DragDropManagerInput['plugins'] = (defaults) => [...defaults, accessibility];
Two compiler details. Write the callbacks inline in configure() and strict mode rejects them with TS7031, an implicit any on operation. And operation.source.index doesn't exist until isSortable() narrows the type (TS2339). Both failing files are in the harness.
Arrow announcements are debounced by 500 ms, a documented default you can change with the debounce option. In my runs the arrow text reached the DOM about 503 ms after the key, against a few milliseconds for pick up and drop. Press three arrows 150 ms apart and only the final position gets written. I like that: a queue of stale positions helps nobody.
Why does focus fall to body mid-drag?
This was the result I didn't see coming. With default settings, document.activeElement was the handle after Space, then <body> after the first ArrowDown, and it stayed there until the drop handed focus back.
The arrows still work, since the keyboard sensor listens on the document once a drag has started. But anything tied to focus, your own :focus-visible ring included, has lost the item. For an accessible list, that's the wrong place to be.
The cause is the optimistic sort, which reorders the real <li> elements during the drag. As a control, I removed that plugin from the sortable. Focus stayed on the handle and the default drop message named t4, the real target, though the list then didn't reorder until the drop. You probably want the preview, so put the focus back instead:
import type { DragOverEvent } from '@dnd-kit/react';
// The sort moves the dragged <li> in the DOM, which blurs the focused handle.
export function keepHandleFocused({ operation }: DragOverEvent): void {
const handle = operation.source?.handle;
if (!(operation.activatorEvent instanceof KeyboardEvent) || !(handle instanceof HTMLElement)) {
return;
}
requestAnimationFrame(() => handle.focus({ preventScroll: true }));
}
With it, the handle was the active element after every key. It isn't a perfect hold: each arrow press still fired a focusout and then a focusin, because the call runs a frame after the move. @dnd-kit/core with @dnd-kit/sortable fired no focus events on any arrow press, because it moves rows with CSS transforms and reorders the DOM only on drop. Pointer drags differ too: they ended with focus on the handle in core and on <body> in react.
A drag library can pass your keyboard test, since the order changes, while focus sits on the document body from the first arrow press to the drop.
Keys, cancel and the Tab surprise
Both packages behaved the same on the keys below.
| Key on a focused handle | Result |
|---|---|
| Space or Enter | picks the item up |
| ArrowDown, ArrowUp | moves it one place |
| Space, Enter or Tab | drops it and saves the new order |
| Escape | cancels and restores the original order |
Tab is the one to check. It commits the move; it doesn't cancel. The keyboard sensor docs list Tab among the end keys, so it's intended, and the custom instructions above say so. If your save is expensive or hard to undo, configure keyboardCodes without it and test what Tab then does to focus.
The core package has its own version of the pickup bug. With default strings, my first reading of its region after Space was "Draggable item t1 was moved over droppable area t1." The "Picked up" sentence never showed up in the DOM, because the item reports itself as hovered at once. Custom onDragOver text needs a guard that returns nothing when over.id equals active.id. Its region also uses aria-live="assertive", where the new package uses polite. The older dnd kit component page shows that guard in full.
Do you still need move up and move down buttons?
Yes. Keyboard support answers WCAG 2.1.1 Keyboard, level A. It doesn't answer 2.5.7 Dragging Movements, level AA, which wants the same outcome from a single pointer without dragging, unless dragging is essential. The W3C is explicit that the two are judged separately. In both packages, clicking one handle and then another changed nothing.
Buttons are the plain fix, and for a short list I'd argue they're enough on their own. A version with no library at all added 586 bytes gzipped.
One detail decides whether they feel broken:
// Focus falls to <body> when the item reaches the top.
<button disabled={index === 0}>Up</button>
// Focus stays. The click handler ignores the impossible move.
<button aria-disabled={index === 0}>Up</button>
I pressed Enter on "Move Check types up" with that item in second place. The disabled version moved it and dropped focus to <body>. The aria-disabled version moved it and kept focus on the same button. Style [aria-disabled="true"] so it looks inactive.
The price of controls is tab stops. For five items I counted:
| List | Tab presses to cross it (stops) |
|---|---|
| Handles only | 5 |
Buttons with disabled at the ends | 8 |
Buttons with aria-disabled | 10 |
| Handle plus both buttons | 15 |
Fifteen stops for five items is a lot. At fifty rows, consider one "Move" menu per row, or buttons that appear for the selected item, and measure your own count.
Renders and bundle size
I counted function body calls of the row component for one item moved down three places, and weighed each list with esbuild (minified, gzip level 9, React left external).
| Setup | Focus during keyboard drag | Row renders, 100 rows | Gzip bytes |
|---|---|---|---|
| react defaults | body | 100 | 39,695 |
| react, buttons and focus call | handle | 100 | 40,324 |
| core 6.3.1 with sortable | handle | 904 | 15,723 |
| Move buttons only | button | 300 | 586 |
The newer package rendered no rows at all while the item was in flight, then each row once on drop. It moves DOM nodes itself and tells React at the end. core re-rendered rows on every step: 49 row renders with five items, 904 with a hundred, and 925 for a pointer drag across the same three places.
Is 904 a problem? For cheap rows, probably not, and these counts say nothing about milliseconds. For rows with charts or editors, record a drag with the React DevTools Profiler before you memoize anything. The byte side is easier to judge: react costs about 2.6 times what core does here, and @dnd-kit/dom alone accounts for 72,462 of its 121,719 minified bytes. The method matches the one in the React icon bundle comparison, a measured difference rather than a number from a package page.
What I would ship, and where this stops
Handle, buttons, position-based announcements, the focus call, exact version pins. If your list is flat and short, drop the library and keep the buttons. If bytes matter more than render counts, stay on core with custom announcements. And if saving a new order makes the list suspend, wrap that update in a transition. The guide to useTransition and useDeferredValue counts fallback mounts with and without one.
The limits matter. Everything here comes from the DOM and Chromium's accessibility tree, in one engine, on one machine. How NVDA, JAWS or VoiceOver voice these regions is outside this harness, and so are touch screens, Firefox, Safari, grids and multi-column boards. Check with the assistive technology your users run. For a list-shaped alternative with its own announcement defaults, see Hello Pangea DnD.
Run it yourself
The harness is dnd-kit-accessible-reorder/ in the public code-examples repository. npm install, npx playwright install chromium, npm test. It type-checks the sources, weighs the bundles, drives every variant and fails if focus, announcements, order or render counts stop matching what's written here. The raw JSON from my five runs is in its results/ folder.