-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(RAC): Tree drag and drop #7692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
903ba60
8f14593
768e253
aa2d362
d9b4d57
5112433
e6becc6
22b88d5
121712a
7c81ea2
0e3554a
02e07de
5be35b6
d7506e9
34073ba
efd5259
5b38175
e0731ed
f7272d9
2cbccd9
8ba1b42
0504991
2383104
a0aa836
8be4765
5e54c62
b9d0746
074a3f6
bb82173
cef6372
ce5d5a8
117446c
20311a9
e01241a
896d405
8066a96
36516f8
92f3b20
7dc4026
9237749
163815e
33f12e2
7ff84d5
42c54f7
b01e3fe
1d99e8c
315cff8
88a4627
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ import { | |
DropTargetDelegate, | ||
Key, | ||
KeyboardDelegate, | ||
KeyboardEvents, | ||
Node, | ||
RefObject | ||
} from '@react-types/shared'; | ||
|
@@ -46,7 +47,8 @@ export interface DroppableCollectionOptions extends DroppableCollectionProps { | |
/** A delegate object that implements behavior for keyboard focus movement. */ | ||
keyboardDelegate: KeyboardDelegate, | ||
/** A delegate object that provides drop targets for pointer coordinates within the collection. */ | ||
dropTargetDelegate: DropTargetDelegate | ||
dropTargetDelegate: DropTargetDelegate, | ||
onKeyDown?: KeyboardEvents['onKeyDown'] | ||
} | ||
|
||
export interface DroppableCollectionResult { | ||
|
@@ -201,7 +203,7 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state: | |
autoScroll.stop(); | ||
}, | ||
onDropActivate(e) { | ||
if (state.target?.type === 'item' && state.target?.dropPosition === 'on' && typeof props.onDropActivate === 'function') { | ||
if (state.target?.type === 'item' && typeof props.onDropActivate === 'function') { | ||
props.onDropActivate({ | ||
type: 'dropactivate', | ||
x: e.x, // todo | ||
|
@@ -741,6 +743,7 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state: | |
break; | ||
} | ||
} | ||
localState.props.onKeyDown?.(e as any); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
}); | ||
}, [localState, ref, onDrop, direction]); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll have to track down what exactly is happening but I noticed the following bug:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another odd case that I discovered:
Project 2 actually becomes a root level folder after this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be that the drop operation thinks the drop position is "After Reports" which technically isn't wrong but it should really be "Before Reports 1" or have a greater degree of granularity (aka "between Reports and Reports 1"). This actually works with keyboard DnD (and has the proper "insert between Reports and Reports 1" drop target) but for some reason is targeting the wrong drop insertion target I think for mouse DnD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we find a way to make this accessible on keyboard/screen reader? That's why it was private before.