Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit f9c37cc

Browse files
committed
fixing moving to an empty list that has padding with a keyboard
1 parent 6538630 commit f9c37cc

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-beautiful-dnd",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Beautiful, accessible drag and drop for lists with React.js",
55
"author": "Alex Reardon <[email protected]>",
66
"keywords": [

src/state/move-cross-axis/move-to-new-droppable/to-foreign-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default ({
4040
const newCenter: Position = moveToEdge({
4141
source: draggable.page.withoutMargin,
4242
sourceEdge: 'start',
43-
destination: droppable.page.withMargin,
43+
destination: droppable.page.withMarginAndPadding,
4444
destinationEdge: 'start',
4545
destinationAxis: axis,
4646
});

test/unit/state/move-cross-axis/move-to-new-droppable.spec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe('move to new droppable', () => {
2525
});
2626

2727
const noMargin: Spacing = { top: 0, left: 0, bottom: 0, right: 0 };
28+
const padding: Spacing = { top: 2, left: 3, bottom: 4, right: 5 };
2829

2930
[vertical, horizontal].forEach((axis: Axis) => {
3031
describe(`on ${axis.direction} axis`, () => {
@@ -39,6 +40,7 @@ describe('move to new droppable', () => {
3940
const home: DroppableDimension = getDroppableDimension({
4041
id: 'home',
4142
direction: axis.direction,
43+
padding,
4244
clientRect: getClientRect({
4345
[axis.start]: 0,
4446
[axis.crossAxisStart]: crossAxisStart,
@@ -301,6 +303,7 @@ describe('move to new droppable', () => {
301303

302304
const foreign: DroppableDimension = getDroppableDimension({
303305
id: 'foreign',
306+
padding,
304307
direction: axis.direction,
305308
clientRect: getClientRect({
306309
[axis.start]: 0,
@@ -398,11 +401,11 @@ describe('move to new droppable', () => {
398401
throw new Error('invalid test setup');
399402
}
400403

401-
it('should move to the start edge of the droppable', () => {
404+
it('should move to the start edge of the droppable (including its padding)', () => {
402405
const expected: Position = moveToEdge({
403406
source: inHome1.page.withoutMargin,
404407
sourceEdge: 'start',
405-
destination: foreign.page.withMargin,
408+
destination: foreign.page.withMarginAndPadding,
406409
destinationEdge: 'start',
407410
destinationAxis: foreign.axis,
408411
});

0 commit comments

Comments
 (0)