Skip to content

Commit

Permalink
fix(cdk:drag-drop): invalid handle
Browse files Browse the repository at this point in the history
  • Loading branch information
tuchg authored and danranVm committed Oct 25, 2022
1 parent c9dfdb6 commit 677b163
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/cdk/drag-drop/src/composables/withDragHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ export const withDragHandle = (sourceEl: HTMLElement, handleEl: HTMLElement, con

handleEl.classList.add('cdk-draggable-handle')

const preventNotHandle = (target: HTMLElement, e: DnDEventType) => {
const preventNotHandle = (target: HTMLElement, _: DnDEventType) => {
if (!handleEl.contains(target)) {
e.preventDefault()
state.end()
}
}
Expand All @@ -35,7 +34,7 @@ export const withDragHandle = (sourceEl: HTMLElement, handleEl: HTMLElement, con

registry.on(sourceEl, 'dragstart', e => preventNotHandle(dragTarget!, e))
} else {
registry.on(sourceEl, 'pointerdown', e => preventNotHandle(e.target as HTMLElement, e))
registry.on(sourceEl, 'mousedown', e => preventNotHandle(e.target as HTMLElement, e))
registry.on(sourceEl, 'touchstart', e => preventNotHandle(e.target as HTMLElement, e))
}
}

0 comments on commit 677b163

Please sign in to comment.