Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Cannot read property "style" of null _rootElement - cdkDrag (drag-drop.es5.js) #15827
What is the expected behavior?
Return out of _pointerMove event (and possibly others, but we're logging _pointerMove crashes only at the moment) if _this._rootElement is null or undefined when dragging without _dropContainer.
What is the current behavior?
_rootElement can be null in the _pointerMove method within drag-drop.es5.js. Throwing an error on line 312 of drag-drop.es5.js when attempting to access "style" of null (_root._rootElement). Possibly event is continuing to fire when parent node has been destroyed or removed?
What are the steps to reproduce?
Unknown, but logs show it is happening mostly on mobile devices (but not exclusively).
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular cdk 7.3.7 +
Is there anything else we should know?
Sorry for the lack of reproducibility, but some safety here for the existence of _rootElement wouldn't hurt imo.
With the current setup I can see how there could be a case where the root element is undefined at the time the dragging starts. I can add some extra guards around it, but it's also possible that the value that is being passed in just isn't resolving to anything. Are you sure that the selector is correct?