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

drag events dataTransfer is undefined in RC5 alpha 7-2 with NgModule imports #1025

Closed
jkyoutsey opened this issue Aug 12, 2016 · 4 comments · Fixed by #1744
Closed

drag events dataTransfer is undefined in RC5 alpha 7-2 with NgModule imports #1025

jkyoutsey opened this issue Aug 12, 2016 · 4 comments · Fixed by #1744
Assignees
Labels
P2 The issue is important to a large percentage of users, with a workaround

Comments

@jkyoutsey
Copy link

jkyoutsey commented Aug 12, 2016

Bug, feature request, or proposal:

Bug: Since adding in Md*Module(s) and hammerjs, drag events no longer contain the dataTransfer property.

browser_adapter.js:84 TypeError: Cannot set property 'effectAllowed' of undefined
    at DraggableDirective.onDragStart (draggable.directive.ts:9)
    at DebugAppView._View_BusinessObjectFieldsListComponent1._handle_dragstart_0_0 (BusinessObjectFieldsListComponent.ngfactory.js:238)
    at view.js:381
    at dom_renderer.js:255
    at hammer_gestures.js:68
    at ZoneDelegate.invoke (zone.js:323)
    at Object.onInvoke (ng_zone_impl.js:53)
    at ZoneDelegate.invoke (zone.js:322)
    at Zone.runGuarded (zone.js:230)
    at NgZoneImpl.runInnerGuarded (ng_zone_impl.js:86)

This did not happen when directly using the Md* components in our components. Once we added the Md*Module(s) to NgModule and installed hammerjs this error arose.

What is the expected behavior?

drag events should have the dataTransfer property to be able to pass data in the dropped element

What is the current behavior?

error above

What are the steps to reproduce?

(I'm working on it, but can't figure out how to get ng2 rc5 and md alpha7-2 all in the same plunker...)
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

Which versions of Angular, Material, OS, browsers are affected?

Angular 2 RC5
Material alpha 7-2
hammerjs 2.0.8
Windows 8.1
Chrome and FF latest

Is there anything else we should know?

It's worth noting that this error occurs in a component with NO MD components in use. But it only happens if we NgModule import the MD components (needed elsewhere in the application). It doesn't make sense, but our draggable div isn't an md-* component! But if I remove them from NgModule imports I can drag it!

@ratscrew
Copy link

+1 hammerjs is overriding the original drag events with no way to access the original event.

@ratscrew
Copy link

Why are "drag", "dragstart" and "dragend" being created as custom events, when they are native events?

https://github.com/angular/material2/blob/master/src/lib/core/gestures/MdGestureConfig.ts

Unless I missed something I don't think "drag", "dragstart" or "dragend" are being used in any component yet.

Thanks in advance :-)

@jelbourn
Copy link
Member

jelbourn commented Nov 3, 2016

We removed dragstart and dragend, but we should also remove drag from gesture config.
https://github.com/angular/material2/blob/b09465cda7cf8c74a5c903ee49d0366d644643d4/src/lib/core/gestures/MdGestureConfig.ts#L10-L10

@jelbourn jelbourn added the P2 The issue is important to a large percentage of users, with a workaround label Nov 3, 2016
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 5, 2016
Removes the `drag` event from the gesture config.

Fixes angular#1025.
@crisbeto crisbeto added the has pr label Nov 5, 2016
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 5, 2016
Removes the `drag` event from the gesture config.

Fixes angular#1025.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 5, 2016
Removes the `drag` event from the gesture config.

Fixes angular#1025.
jelbourn pushed a commit that referenced this issue Nov 8, 2016
Removes the `drag` event from the gesture config.

Fixes #1025.
rolandjitsu pushed a commit to rolandjitsu/material2 that referenced this issue Nov 10, 2016
Removes the `drag` event from the gesture config.

Fixes angular#1025.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants