File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
packages/components/src/__builtins__ Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,9 @@ export function SortableContainer<T extends React.HTMLAttributes<HTMLElement>>(
30
30
} ) => {
31
31
const _onSortEnd = ( event : DragEndEvent ) => {
32
32
const { active, over } = event
33
- const oldIndex = ( active . id as number ) - 1
34
- const newIndex = ( over ?. id as number ) - 1
33
+ if ( ! over ) return
34
+ const oldIndex = + active . id - 1
35
+ const newIndex = + over . id - 1
35
36
onSortEnd ?.( {
36
37
oldIndex,
37
38
newIndex,
@@ -91,13 +92,14 @@ export function SortableElement<T extends React.HTMLAttributes<HTMLElement>>(
91
92
}
92
93
93
94
const style = useMemo ( ( ) => {
95
+ const zIndex = transform ? 1 : 'none'
94
96
const itemStyle : React . CSSProperties = {
95
97
position : 'relative' ,
96
98
touchAction : 'none' ,
97
- zIndex : 1 ,
98
- transform : `translate3d( ${ transform ?. x || 0 } px, ${
99
- transform ?. y || 0
100
- } px, 0)` ,
99
+ zIndex,
100
+ transform : transform
101
+ ? `translate3d( ${ transform . x } px, ${ transform . y } px, 0)`
102
+ : 'none' ,
101
103
transition : `${ transform ? 'all 200ms ease' : '' } ` ,
102
104
}
103
105
const dragStyle = {
You can’t perform that action at this time.
0 commit comments