-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(drag-drop): avoid interfering with element clicks #13152
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/cdk/drag-drop/drag.ts
Outdated
* Minimum amount of pixels that the user should | ||
* drag, before the CDK initiates a drag sequence. | ||
*/ | ||
minimumDragDistance: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of dragStartThreshold
?
src/cdk/drag-drop/drag.ts
Outdated
* @param referenceElement Element that started the drag sequence. | ||
* @param event Browser event object that started the sequence. | ||
*/ | ||
private _prepareDragSequence(referenceElement: HTMLElement, event: MouseEvent | TouchEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about _resetDragSequence
or _initializeDragSequence
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with _initializeDragSequence
. _resetDragSequence
sounds like something you'd call once the sequence is done.
Resolves a long-standing TODO about starting the drag&drop sequence after the user has dragged over a certain amount of pixels, rather than starting it immediately on `mousedown`/`touchstart`. This prevents random clicks and taps on the element from being interpreted as dragging and avoids potentially interrupting the native click events on children of `CdkDrag`.
ec36d42
to
32c55de
Compare
Resolves a long-standing TODO about starting the drag&drop sequence after the user has dragged over a certain amount of pixels, rather than starting it immediately on `mousedown`/`touchstart`. This prevents random clicks and taps on the element from being interpreted as dragging and avoids potentially interrupting the native click events on children of `CdkDrag`.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Resolves a long-standing TODO about starting the drag&drop sequence after the user has dragged over a certain amount of pixels, rather than starting it immediately on
mousedown
/touchstart
. This prevents random clicks and taps on the element from being interpreted as dragging and avoids potentially interrupting the native click events on children ofCdkDrag
.