Skip to content
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

Cannot read property "style" of null _rootElement - cdkDrag (drag-drop.es5.js) #15827

Open
PastoTreering opened this Issue Apr 15, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@PastoTreering
Copy link

PastoTreering commented Apr 15, 2019

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.

@PastoTreering

This comment has been minimized.

Copy link
Author

PastoTreering commented Apr 15, 2019

Sentry log:
Screen Shot 2019-04-15 at 2 23 06 PM

@crisbeto crisbeto self-assigned this Apr 15, 2019

@crisbeto

This comment has been minimized.

Copy link
Member

crisbeto commented Apr 16, 2019

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?

@PastoTreering

This comment has been minimized.

Copy link
Author

PastoTreering commented Apr 17, 2019

Selector looks right to me, I can't actually reproduce the error through my many tests, but we have a lot of error logs coming in reporting it from our users.

@crisbeto

This comment has been minimized.

Copy link
Member

crisbeto commented Apr 17, 2019

Is there any information on which browser versions are running into the error?

@PastoTreering

This comment has been minimized.

Copy link
Author

PastoTreering commented Apr 18, 2019

Here's a broad overview of the usage circumstances. It's mostly on android mobile devices, and chrome browser (mobile and desktop), but not exclusively.
Screen Shot 2019-04-18 at 12 28 44 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.