Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Preventing propagation with nested menus involving draggable elements... #154

Merged
merged 1 commit into from
Oct 2, 2017

Conversation

ajhenri
Copy link
Contributor

@ajhenri ajhenri commented Sep 29, 2017

Hello vkbansal!

Before explaining this, I just want to say thank you for building this awesome project! It has helped immensely with my current work. I was able to use this seamlessly with 'react-dnd'. I am not permitted to share the source of what I have been working on that helped me discover the following issue.

I have been working on a project (react v15.6.1) where I have draggable elements/boxes upon droppable grid cells where both the grid cells and the draggable elements have context menus attached. Everything worked perfectly, except for when I am using the holdToDisplay (this is happening both on mobile and desktop). For some reason, on desktop and mobile devices (like the iPad), whenever I click/touch & hold on one of the elements/boxes (on top of the grid cell), it will open up the menu of the grid cell instead of the menu of the nested element. In other words, the event propagates to the parent, which is what I don't want.

I understand that the nested menu example on your demo page is working. But in my case, using react-dnd and their html5/touch backends, it is not.

While I unfortunately do not have an example fiddle to show (since I don't have the time at the moment), I do have this pull request, adding 2 simple lines which I have confirmed (on both desktop and mobile) fixes my issue.

All tests passed. Let me know what you think...

Thanks,
AJ

@vkbansal vkbansal merged commit 5973169 into vkbansal:master Oct 2, 2017
@kinke
Copy link

kinke commented Oct 4, 2017

Thanks, we had the same issue with an apparently very similar setup (also using react-dnd with html5 backend). The context menu still pops up while dragging an item (with context menu) though - at the item's original location - most of the time, unless dragging it away very quickly (way under the 1 second holdToDisplay).

@ajhenri ajhenri deleted the holdToDisplayPropagationFix branch October 4, 2017 19:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants