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', () => {
17651765 expect ( previewRect . height ) . toBe ( itemRect . height , 'Expected preview height to match element' ) ;
17661766 expect ( preview . style . pointerEvents )
17671767 . 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.' ) ;
17681770
17691771 dispatchMouseEvent ( document , 'mouseup' ) ;
17701772 fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -867,6 +867,8 @@ export class DragRef<T = any> {
867867 // It's important that we disable the pointer events on the preview, because
868868 // it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
869869 pointerEvents : 'none' ,
870+ // We have to reset the margin, because can throw off positioning relative to the viewport.
871+ margin : '0' ,
870872 position : 'fixed' ,
871873 top : '0' ,
872874 left : '0' ,
You can’t perform that action at this time.
0 commit comments