File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -1765,6 +1765,8 @@ describe('CdkDrag', () => {
1765
1765
expect ( previewRect . height ) . toBe ( itemRect . height , 'Expected preview height to match element' ) ;
1766
1766
expect ( preview . style . pointerEvents )
1767
1767
. toBe ( 'none' , 'Expected pointer events to be disabled on the preview' ) ;
1768
+ // Use a regex here since some browsers normalize 0 to 0px, but others don't.
1769
+ expect ( preview . style . margin ) . toMatch ( / ^ 0 ( p x ) ? $ / , 'Expected the preview margin to be reset.' ) ;
1768
1770
1769
1771
dispatchMouseEvent ( document , 'mouseup' ) ;
1770
1772
fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -867,6 +867,8 @@ export class DragRef<T = any> {
867
867
// It's important that we disable the pointer events on the preview, because
868
868
// it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
869
869
pointerEvents : 'none' ,
870
+ // We have to reset the margin, because can throw off positioning relative to the viewport.
871
+ margin : '0' ,
870
872
position : 'fixed' ,
871
873
top : '0' ,
872
874
left : '0' ,
You can’t perform that action at this time.
0 commit comments