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

Consider the option to use drag events instead #77

Open
jmbockhorst opened this issue Jul 6, 2020 · 2 comments
Open

Consider the option to use drag events instead #77

jmbockhorst opened this issue Jul 6, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@jmbockhorst
Copy link

Specifically, using ondragstart instead of onmousedown for the DragStart event. Although users would have to specify the draggable attribute on their elements (which is why it should be optional), it would allow users to handle the onclick event on the draggable element. Currently, handling a click on the drag handler isn’t possible because onmousedown always fires first.

@annaghi
Copy link
Owner

annaghi commented Jul 9, 2020

Thank you for reporting this, I will check how to integrate it.

@annaghi annaghi added the enhancement New feature or request label Jul 9, 2020
@K-Adam
Copy link

K-Adam commented Jul 17, 2020

Specifically, using ondragstart instead of onmousedown for the DragStart event. Although users would have to specify the draggable attribute on their elements (which is why it should be optional), it would allow users to handle the onclick event on the draggable element. Currently, handling a click on the drag handler isn’t possible because onmousedown always fires first.

If you would like to handle onClick event on a button inside a draggable item, just use Html.Events.stopPropagationOn "mousedown", like this:

button
  [ onClick MyOnClickMsg
  , Html.Events.stopPropagationOn "mousedown" <| Decode.succeed (Noop, True)
  ]
  [ text "button inside a draggable container" )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants