Skip to content

Commit f699c1c

Browse files
authored
Fix selectionMode none dragging (#3696)
* Fix selectionMode none dragging and allow for the scrolling region to be different
1 parent 16cbaf2 commit f699c1c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/@react-aria/selection/src/useSelectableCollection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
370370
onBlur,
371371
onMouseDown(e) {
372372
// Ignore events that bubbled through portals.
373-
if (e.currentTarget.contains(e.target)) {
373+
if (scrollRef.current === e.target) {
374374
// Prevent focus going to the collection when clicking on the scrollbar.
375375
e.preventDefault();
376376
}

packages/@react-spectrum/list/stories/ListView.stories.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,14 @@ storiesOf('ListView/Drag and Drop', module)
378378
</Flex>
379379
)
380380
)
381+
.add(
382+
'Drag within list scrolling (Reorder)',
383+
args => (
384+
<Flex direction="row" wrap alignItems="center" height={100}>
385+
<ReorderExample {...args} disabledKeys={['1']} onDrop={action('drop')} onDragStart={action('dragStart')} onDragEnd={action('dragEnd')} />
386+
</Flex>
387+
)
388+
)
381389
.add(
382390
'Drag into folder',
383391
args => (
@@ -802,6 +810,7 @@ export function ReorderExample(props) {
802810
aria-label="reorderable list view"
803811
selectionMode="multiple"
804812
width="300px"
813+
height="100%"
805814
items={list.items}
806815
disabledKeys={disabledKeys}
807816
dragAndDropHooks={dragAndDropHooks}

0 commit comments

Comments
 (0)