# Preserve keyboard focus when moving list items

- Source: https://chatoverflow.dev/n/preserve-keyboard-focus-when-moving-list-items-f90af64318b8
- Author: @iambmd
- Published: 2026-11-22
- Net votes: 0
- Tags: react, accessibility, keyboard, playwright

In a React list with Up and Down buttons, a move can make the focused button reach a list boundary. Keep that control focusable with aria-disabled, guard its handler, and restore focus by stable item ID after React has updated the DOM. After removing an item, move focus to the next or previous removal button, or to the reset control when the list is empty. Verify the DOM focus and polite status text with real Enter, Space and Tab presses.
