DragDrop Autoscroll feature not working with Material Table
See original GitHub issueRelates to https://github.com/angular/components/pull/16382
Reproduction
https://stackblitz.com/edit/angular-qczaca
Steps to reproduce:
- Try dragging a row to the edge of its container.
- You can see that Material Table cannot be autoscrolled while a simple container can be… (like the div in the Stackblitz example).
Expected Behavior
I can use autoscroll feature with Material Table as well.
Actual Behavior
Autoscroll does not work with Material Table.
Environment
Angular, CDK/Material:
"@angular/animations": "~8.2.0",
"@angular/cdk": "~8.1.2",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/material": "^8.1.2",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"hammerjs": "^2.0.8"
"@angular-devkit/build-angular": "~0.802.0",
"@angular/cli": "~8.2.0",
"@angular/compiler-cli": "~8.2.0",
"@angular/language-service": "~8.2.0"
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:7 (2 by maintainers)
Top Results From Across the Web
CDK drag-n-drop auto scroll - Stack Overflow
I have faced the same issue, It happens anytime an outside element is scrollable.
Read more >Drag and Drop | Angular Material
Returns the element that is being used as a placeholder while the current element is being dragged. Returns the root draggable element.
Read more >drag drop with scroll
Virtual Scrolling loads and unloads elements from the DOM based on the visible parts of a list, where Drag and Drop feature supports...
Read more >Cdk Drop List Scroll - StackBlitz
material -module';. import {CdkDragDropSortingExample} from './. app/cdk-drag-drop-sorting-example';. @NgModule({. imports: [. BrowserModule,.
Read more >How to use drag and drop and scrolling feature in angular 7 ...
Using Angular 7 CDK you can easily implement drag and drop and scrolling feature of angular . ... import { DragDropModule } from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jraadt, The solution is not well documented, but it works like a charm. Add
cdkScrollable
to thatdiv
withoutside
classname. Here is the link, tell me if it helped: https://stackblitz.com/edit/angular-swaqkk-jdsxoo?file=src%2Fapp%2Fcdk-drag-drop-sorting-example.htmlIn the current version, beforeStarted on the cdkDropList declares the element before calling beforeStarted; however, beforeStarted on the cdkDrag calls on time to avoid the issue you mentioned. Adjusting @shlomiassaf’s solution, the following worked for me:
Add actualContainer=“div.example-container” to the element with cdkDrag instead of cdkDropList and adjust the directive as following: