Accessibility (a11y)
Congratulations, DragSelect is accessible by default 🎉
TLDR;
=> Yourselectables
should be buttons:<button type="button"></button>
.
=> ArrowKeys are used for keyboard dragging.
Obviously, keyboard users won’t get the full visual experience but it works similarly to the OS default behavior.
Selection: You can select items using the default select keys (usually space or enter) and also multi-select when using a modifier key at the same time. There is one little thing you have to do tho’: the
selectables
have to be pressable (clickable)! To achieve this, they should be of type<button type="button"></button>
.Drag: You can drag elements using the keyboard arrow keys, this will also scroll the area by default. You can press Shift in combination with an arrow i.e. Shift+ArrowRight to move the element 4x faster and also not scroll the area.
Try it out with your keyboard: