Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cdk/drag-drop/directives/drag.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,8 @@ describe('CdkDrag', () => {
expect(previewRect.height).toBe(itemRect.height, 'Expected preview height to match element');
expect(preview.style.pointerEvents)
.toBe('none', 'Expected pointer events to be disabled on the preview');
// Use a regex here since some browsers normalize 0 to 0px, but others don't.
expect(preview.style.margin).toMatch(/^0(px)?$/, 'Expected the preview margin to be reset.');

dispatchMouseEvent(document, 'mouseup');
fixture.detectChanges();
Expand Down
2 changes: 2 additions & 0 deletions src/cdk/drag-drop/drag-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ export class DragRef<T = any> {
// It's important that we disable the pointer events on the preview, because
// it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
pointerEvents: 'none',
// We have to reset the margin, because can throw off positioning relative to the viewport.
margin: '0',
position: 'fixed',
top: '0',
left: '0',
Expand Down