Sensors
Keyboard Sensor
Detect keyboard input to initiate drag and drop operations.
Overview
The Keyboard sensor enables keyboard-based drag and drop interactions. It is enabled by default in the DragDropManager.
Usage
Default Key Bindings
The Keyboard sensor comes with these default key bindings:
Customizing Key Bindings
You can customize which keys trigger different actions:
Default behavior
By default, each key press moves the dragged item by 10 pixels. Hold Shift to move by 50 pixels instead.
API Reference
Options
Configure which keyboard codes trigger different actions:
Events
The Keyboard sensor handles these events:
keydown
: Key press detectionkeyup
: Key release detection
Activation
The sensor activates when:
- A draggable element or its handle has focus
- A configured start key is pressed
- The element isn’t disabled
Best Practices
-
Provide clear focus indicators:
- Use visible focus rings
- Maintain sufficient contrast
-
Support screen readers:
- Use proper ARIA attributes
- Provide clear instructions
-
Consider key combinations:
- Avoid conflicts with browser shortcuts
- Support standard keyboard patterns