Skip to content

Commit 1c74b03

Browse files
crisbetojelbourn
authored andcommitted
perf(drag-drop): remove expensive style recalculation (#14189)
Removes an expensive style recalculation of the entire body from `drag-drop`. The issue that the code was solving isn't very common (the user starts dragging and then they yank their cursor out of the edge of the screen on Safari) and when it happens, things will generally still work.
1 parent e5cd530 commit 1c74b03

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/cdk/drag-drop/drag-drop-registry.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {Injectable, NgZone, OnDestroy, Inject} from '@angular/core';
1010
import {DOCUMENT} from '@angular/common';
1111
import {normalizePassiveListenerOptions} from '@angular/cdk/platform';
1212
import {Subject} from 'rxjs';
13-
import {toggleNativeDragInteractions} from './drag-styling';
1413

1514
/** Event options that can be used to bind an active, capturing event. */
1615
const activeCapturingEventOptions = normalizePassiveListenerOptions({
@@ -123,10 +122,6 @@ export class DragDropRegistry<I, C extends {id: string}> implements OnDestroy {
123122
const moveEvent = isTouchEvent ? 'touchmove' : 'mousemove';
124123
const upEvent = isTouchEvent ? 'touchend' : 'mouseup';
125124

126-
// We need to disable the native interactions on the entire body, because
127-
// the user can start marking text if they drag too far in Safari.
128-
toggleNativeDragInteractions(this._document.body, false);
129-
130125
// We explicitly bind __active__ listeners here, because newer browsers will default to
131126
// passive ones for `mousemove` and `touchmove`. The events need to be active, because we
132127
// use `preventDefault` to prevent the page from scrolling while the user is dragging.
@@ -163,7 +158,6 @@ export class DragDropRegistry<I, C extends {id: string}> implements OnDestroy {
163158

164159
if (this._activeDragInstances.size === 0) {
165160
this._clearGlobalListeners();
166-
toggleNativeDragInteractions(this._document.body, true);
167161
}
168162
}
169163

0 commit comments

Comments
 (0)