You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An extension of [@hello-pangea/dnd](https://github.com/hello-pangea/dnd) (which is an actively maintained fork of [react-beautiful-dnd](https://github.com/atlassian/react-beautiful-dnd)) with a compatible API and built-in style opinions. Functionality results from 3 components working together:
7
+
```mdx-code-block
8
+
import { EuiLink } from '@elastic/eui';
9
+
```
10
+
11
+
An extension of <EuiLinkhref="https://github.com/hello-pangea/dnd"target="_blank">@hello-pangea/dnd</EuiLink> (which is an actively maintained fork of <EuiLinkhref="https://github.com/atlassian/react-beautiful-dnd"target="_blank">react-beautiful-dnd</EuiLink>) with a compatible API and built-in style opinions. Functionality results from 3 components working together:
12
+
13
+
-`<EuiDragDropContext />`: Section of your application containing the draggable elements and the drop targets.
14
+
-`<EuiDroppable />`: Area into which items can be dropped. Contains one or more `<EuiDraggable />`.
15
+
-`<EuiDraggable />`: Items that can be dragged. Must be part of an `<EuiDroppable />`.
8
16
9
-
*`<EuiDragDropContext />`: Section of your application containing the draggable elements and the drop targets.
10
-
*`<EuiDroppable />`: Area into which items can be dropped. Contains one or more `<EuiDraggable />`.
11
-
*`<EuiDraggable />`: Items that can be dragged. Must be part of an `<EuiDroppable />`
17
+
:::accessibility Consider your users and use case
12
18
13
-
:::warning Consider your users and use case
19
+
Drag and drop is often less suitable than standard form inputs. It relies on spatial orientation, which can be difficult for screen reader users. Keyboard navigation typically does not afford the same nuanced manipulation as a mouse. The `@hello-pangea/dnd` package ensures a good amount of accessibility but carefully consider your users' context when choosing this pattern.
20
+
21
+
:::
14
22
15
-
Drag and drop interfaces are not well-adapted to many cases, and may be less suitable than other form types for data operations. For instance, drag and drop interaction relies heavily on spatial orientation that may not be entirely valid to all users (e.g., screen readers as the sole source of information). Similarly, users navigating by keyboard may not be afforded nuanced, dual-axis drag item manipulation.
23
+
:::warning Limitations
16
24
17
-
EUI (largely due to the great work already in @hello-pangea/dnd) has and will continue to ensure accessibility where possible. With that in mind, keep your users' working context in mind.
25
+
One of the limitations of <EuiLinkhref="https://github.com/hello-pangea/dnd"target="_blank">@hello-pangea/dnd</EuiLink> is **nested drag and drop** (dragging elements between nesting levels). For this use case, we recommend using <EuiLinkhref="https://atlassian.design/components/pragmatic-drag-and-drop/about"target="_blank">Pragmatic drag and drop</EuiLink>. Check out our [Nested drag and drop pattern](../../patterns/nested-drag-and-drop/index.mdx) for a simplified example of how to implement it.
18
26
19
27
:::
20
28
@@ -28,16 +36,16 @@ All **EuiDragDropContext** elements are discrete and isolated; **EuiDroppables**
28
36
29
37
**EuiDragDropContext** handles all events but makes no assumptions about the result of a drop event. As such, the following event handlers are available:
30
38
31
-
*`onBeforeDragStart`
32
-
*`onDragStart`
33
-
*`onDragUpdate`
34
-
*`onDragEnd` (required)
39
+
-`onBeforeDragStart`
40
+
-`onDragStart`
41
+
-`onDragUpdate`
42
+
-`onDragEnd` (required)
35
43
36
44
EUI also provides methods for helping to deal to common action types:
37
45
38
-
*`reorder`: change an item's location in a droppable area
39
-
*`copy`: create a duplicate of an item in a different droppable area
40
-
*`move`: move an item to a different droppable area
46
+
-`reorder`: change an item's location in a droppable area
47
+
-`copy`: create a duplicate of an item in a different droppable area
48
+
-`move`: move an item to a different droppable area
@@ -143,7 +151,9 @@ By default the entire element surface can initiate a drag. To specify an element
143
151
The `provided` parameter on the **EuiDraggable**`children` render prop has all data required for functionality. Along with the `customDragHandle` flag,`provided.dragHandleProps` needs to be added to the intended handle element.
144
152
145
153
:::accessibility Accessibility requirement
154
+
146
155
**Icon-only** custom drag handles require an accessible label. Add an `aria-label="Drag handle"` attribute to your React component or HTML element that receives`provided.dragHandleProps`.
0 commit comments