-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
feat(drag-drop): New Optional Input [cdkDragStartPredicate] #30101
Comments
@endlacer you can use cdkDragDisabled to dynamically handle drag and drop action |
|
Disabling the drag and drop action is too late in this case: Also, this is just one possible use case |
@crisbeto does that mean i can build it and do a PR or won't it get added anyway? |
Feel free to send out a PR for it. |
@crisbeto `INFO: Build completed successfully, 7 total actions manifest file name: bazel-out/x64_windows-fastbuild/bin/src/cdk/drag-drop/unit_tests_debug.exe.runfiles_manifest |
Feature Request
Problem Statement
Currently, the CdkDrag directive doesn't provide a way to conditionally prevent drag operations from starting based on the initial mouse/touch event. This makes it impossible to implement complex drag start conditions, such as only allowing drags from specific elements or under certain event conditions.
Add a new input [cdkDragStartPredicate] to the CdkDrag directive that accepts a predicate function to determine whether a drag operation should start.
Proposed API
Example Usage
HTML:
component:
See: https://stackblitz.com/edit/wc3rt4?file=src%2Fexample%2Fcdk-drag-drop-sorting-example.css
Details
Benefits
Implementation Notes
Related Issues
This would also resolve this issue: #14117
Use Case
The text was updated successfully, but these errors were encountered: