Nested Draggable components : event.stopPropagation() not working on MouseEvents

Open
#549 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, react
Domain
frontend

Research direction

The issue names no files, tests, or entry points. Start by reproducing two nested Draggable components with the shown handleDrag handler, then trace how MouseEvents reach each component. Done would require a documented or tested resolution for whether propagation should be preventable and what behavior is expected.

Written by the indexing model from the issue text.

Description

I have two nested <Draggable /> components.

I set the handleDrag on the deepest element as so:

  const handleDrag = (e, data) => {
    // Do the job
    e.stopPropagation();
    e.preventDefault();
  }

but even like this, the handleDrag function of the higher element is called. Is that expected? How can I prevent this behavior?

Thanks

Dominant language
JavaScript
Stars
9.3k
Forks
1k
Avg merge
3d 8h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-grid-layout/react-draggable

All issues in react-grid-layout/react-draggable

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.