Skip to content

Commit 6969911

Browse files
draganescuclaude
andcommitted
Compose: Document when useDropZone drags start and end
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e75e670 commit 6969911

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎packages/compose/src/hooks/use-drop-zone/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ const WithoutWrapperDropZoneElement = () => {
5959
- _props_ `Object`: Named parameters.
6060
- _props.dropZoneElement_ `HTMLElement`: Optional element to be used as the drop zone.
6161
- _props.isDisabled_ `boolean`: Whether or not to disable the drop zone.
62-
- _props.onDragStart_ `( e: DragEvent ) => void`: Called when dragging has started.
62+
- _props.onDragStart_ `( e: DragEvent ) => void`: Called when dragging has started, on the first `dragenter` or `dragover` in the document. A drag can start on a `dragover`, as Chrome can skip the `dragenter` in an iframe.
6363
- _props.onDragEnter_ `( e: DragEvent ) => void`: Called when the zone is entered.
6464
- _props.onDragOver_ `( e: DragEvent ) => void`: Called when the zone is moved within.
6565
- _props.onDragLeave_ `( e: DragEvent ) => void`: Called when the zone is left.
66-
- _props.onDragEnd_ `( e: MouseEvent ) => void`: Called when dragging has ended.
66+
- _props.onDragEnd_ `( e: MouseEvent ) => void`: Called when dragging has ended, on a `dragend` or a drop in the zone, or on the first `mousemove` with no button held, for drags that end outside the document.
6767
- _props.onDrop_ `( e: DragEvent ) => void`: Called when dropping in the zone.
6868

6969
_Returns_

‎packages/compose/src/hooks/use-drop-zone/types.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export interface UseDropZoneProps {
88
*/
99
isDisabled?: boolean;
1010
/**
11-
* Called when dragging has started.
11+
* Called when dragging has started, on the first `dragenter` or
12+
* `dragover` in the document. A drag can start on a `dragover`, as Chrome
13+
* can skip the `dragenter` in an iframe.
1214
*/
1315
onDragStart?: ( e: DragEvent ) => void;
1416
/**
@@ -24,7 +26,9 @@ export interface UseDropZoneProps {
2426
*/
2527
onDragLeave?: ( e: DragEvent ) => void;
2628
/**
27-
* Called when dragging has ended.
29+
* Called when dragging has ended, on a `dragend` or a drop in the zone,
30+
* or on the first `mousemove` with no button held, for drags that end
31+
* outside the document.
2832
*/
2933
onDragEnd?: ( e: MouseEvent ) => void;
3034
/**

0 commit comments

Comments
 (0)