fix(a11y): every sortable list speaks the user's language to a screen reader

dnd-kit's screen-reader text is hard-coded English and names an item by its id ("Draggable item
10357 was dropped", a role of "sortable"). Only the YouTube playlist replaced it; the Plex playlist,
the saved-views list and the side-panel groups read it out under a Hungarian UI — found while
checking the Plex playlist's keyboard reorder on localdev.

`ui/sortableA11y` is now the one place: `useSortableA11y` gives a DndContext its instructions and
announcements (HU/EN, `common.dnd.*`), `useSortableItem` announces the role. The YouTube playlist's
own announcements move onto it, which also fixes them: its lists reorder on drop, so reading the
dragged row's own index said "moved to position 1" at every step and "dropped at position 1"
wherever the row went. The place announced is now the slot the row would land in.

A `local/sortable-a11y` lint rule (with its contract test) refuses a DndContext without
`accessibility` and a direct `useSortable`.
This commit is contained in:
2026-09-19 17:37:21 +02:00
parent 946c8f26db
commit 17a26894b0
13 changed files with 273 additions and 57 deletions
+9 -1
View File
@@ -35,5 +35,13 @@
"moreRefine": "{{count}} more — refine with search",
"matchMode": "Match",
"removeNamed": "Remove {{name}}",
"resetNamed": "Reset {{name}}"
"resetNamed": "Reset {{name}}",
"dnd": {
"instructions": "Press space to pick up an item, the arrow keys to move it, space again to drop it, or escape to cancel.",
"roleDescription": "movable item",
"pickedUp": "Picked up “{{title}}”, position {{pos}} of {{total}}.",
"movedOver": "“{{title}}” moved to position {{pos}} of {{total}}.",
"dropped": "“{{title}}” dropped at position {{pos}} of {{total}}.",
"cancelled": "Move cancelled; “{{title}}” is back at position {{pos}}."
}
}