Skip to content

Drag and drop

What component has

Keyboard support

Keyboard support
KeyFunction
TabMoves focus to the next focusable element.
Shift+TabMoves focus to the previous focusable element.
SpaceSelects the focused object and start dragging.
, , , arrow keysMove the focused object in the direction indicated by the key.
Space (while dragging)Stops dragging.
EscDiscards dragging.

Roles & attributes

The list below describes roles and attributes that component already has.

Roles and attributes
RoleAttributeElementUsage
alertdivIdentifies the element as the container where alert content will be added or updated.
aria-live="assertive"divThis doesn't have to be declared in the code because it is implicit in the alert role. Tells assistive technologies to interrupt other processes to provide users with immediate notification of relevant alert container changes.
tabIndex="0"divMakes the elements focusable and includes them in the page Tab sequence.

Aria-live messages

Text message for assistive technologies that will be read when the user interacts with the component.

ActionMessage template
Item was just grabbed${itemText} grabbed, current position is ${index + 1} of ${itemsCount}
Item is grabbingGrabbing ${itemText}, drop position is ${itemIndex + 1} of ${itemsCount}
Item is dropped${itemText} dropped, final position is ${index + 1} of ${itemsCount}

If grabbed item or zone to drop has zoneName, messages will be like in the follow table.

ActionMessage template
Item was just grabbed${itemText} grabbed, current position is ${itemPosition} of ${itemsCount} in ${zoneName}
Item is grabbing over area with another itemsGrabbing ${itemText}, drop position is ${itemPosition} of ${itemsCount} in ${zoneName}
Item is grabbing over area without any itemsGrabbing ${itemText}, drop in ${zoneName}
Item is dropped in drop zone with another items${itemText} dropped, final position is ${itemPosition} of ${itemsCount} in ${zoneName}
Item is dropped in drop zone without any items${itemText} dropped in ${zoneName}

Other recommendations

See more accessibility recommendations in the common Accessibility guide.

Automated screen reader testing

Intergalactic v15.29.0, React v18.2.0, Playwright v1.25.1, Guidepup v0.13.1, MacOS Monterey 12.

Running screen reader against this file.

1. Screen reader goes into the active element.
2. Screen reader says "Overview selected tab, 1 of 3".
3. Screen reader goes to the next element.
4. Screen reader says "new Issues tab, 2 of 3".
5. Screen reader presses the "Space" button.
6. Screen reader says "newIssues grabbed, current position is 2 of 3".
7. Screen reader goes to the next element.
8. Screen reader says "new Issues tab, 3 of 3".
9. Screen reader presses the "Space" button.
10. Screen reader says "newIssues dropped, final position is 3 of 3".
1. Screen reader goes into the active element.
2. Screen reader says "Overview selected tab, 1 of 3".
3. Screen reader goes to the next element.
4. Screen reader says "new Issues tab, 2 of 3".
5. Screen reader presses the "Space" button.
6. Screen reader says "newIssues grabbed, current position is 2 of 3".
7. Screen reader goes to the next element.
8. Screen reader says "new Issues tab, 3 of 3".
9. Screen reader presses the "Space" button.
10. Screen reader says "newIssues dropped, final position is 3 of 3".

Released under the MIT License.

Released under the MIT License.