Overview
Plugins extend theDragDropManager with additional functionality like accessibility, visual feedback, and auto-scrolling. The default preset includes:
- Accessibility - Screen reader support
- AutoScroller - Auto-scroll when near edges
- Cursor - Cursor styling during drag
- Feedback - Visual drag feedback
- PreventSelection - Prevent text selection
- ScrollListener - Tracks scroll events
- Scroller - Manages scrolling logic
- StyleInjector - Injects plugin styles
Accessibility
Provides screen reader announcements and ARIA attributes for drag-and-drop operations.Options
Features
The Accessibility plugin automatically:- Adds
role="button"to draggable elements (if not already a button) - Adds
aria-roledescription="draggable"attribute - Adds
aria-describedbypointing to instructions - Sets
aria-pressed/aria-grabbedto indicate drag state - Sets
aria-disabledbased on draggable state - Ensures elements are focusable with
tabindex="0" - Creates a live region for screen reader announcements
AutoScroller
Automatically scrolls containers when dragging near their edges.Options
Behavior
- Automatically detects scrollable containers
- Scrolls when the dragged element is within the threshold zone
- Scroll speed increases as you get closer to the edge
- Works with nested scrollable containers
- Automatically disabled during keyboard dragging
Cursor
Changes the cursor style during drag operations.Options
Example
Feedback
Provides visual feedback during drag operations with drag overlays and drop animations.Options
Feedback Types
Default Feedback
- Original element hidden with placeholder
- Element follows cursor
- Smooth drop animation back to final position
Move Feedback
- Element itself moves (no clone)
- No placeholder left behind
- Good for simple reordering
Clone Feedback
- Original element stays visible
- Clone follows cursor
- Good for copy operations or when source stays visible
No Feedback
- No visual feedback
- Useful for custom implementations
Drop Animation
Customize the animation when dropping:Per-Entity Configuration
Feedback can be configured per draggable:PreventSelection
Prevents text selection during drag operations.Usage
- Applies
user-select: noneduring drag - Removes any existing text selection
- Listens for selection changes and clears them
Scroller
Core scrolling logic used by AutoScroller. Generally used internally.Usage
ScrollListener
Tracks scroll events for collision detection updates. Always included automatically.Usage
StyleInjector
Injects CSS for plugins into the document. Always included automatically.Usage
Example: Custom Plugin Configuration
Example: Minimal Setup
Type Definitions
Related
- DragDropManager - Configure the manager
- Sensors - Input handling
- Sortable - High-level API