Unable to Select Text Within Draggable Elements
Author: VituliCreated Feb 24, 2025Updated May 5, 2025
Labelsuntriagedunconfirmed-bug
Expected behavior
Text inside draggable elements should be selectable for copy without interfering with drag functionality.
Actual behavior
Text within draggable elements is not selectable because the library captures mouse events for dragging, preventing text selection.
Steps to reproduce
- Create a draggable element using
Draggablefromreact-beautiful-dnd. - Add a text element inside the draggable element.
- Attempt to select the text using the mouse.
- Notice that the text cannot be selected because the drag event is triggered.
Suggested solution?
Add a prop like allowTextSelection or provide a built-in way to allow text selection within draggable elements without needing to manually stop propagation.
Current workaround:
<Draggable draggableId="item-1" index={0}>
{(provided) => (
<div ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps}>
<span onMouseDown={(e) => e.stopPropagation()}>Selectable Text</span>
</div>
)}
</Draggable>Source: atlassian/react-beautiful-dnd