Trying to implement some drag and drop. My code has so far used
onStopAll "dragover" NoOp
where
onStopAll : String -> a -> Attribute a
onStopAll evt msgCreator =
onWithOptions evt
{ stopPropagation = True, preventDefault = True }
(Jdec.succeed msgCreator)
It works, but gives me loads of NoOp
s which is affecting performance. I found https://medium.com/elm-shorts/elm-drag-and-drop-game-630205556d2 and then tried:
attribute "ondragover" "return false"
That fixes everything. But what I had first tried was variations on
onSkipMsg : String -> Attribute msg
onSkipMsg evt =
onWithOptions evt
{ stopPropagation = False, preventDefault = True }
(Json.Decode.fail "no message")
but that didnât seem to play nicely with the ondrop
event I also need to handle. Anyone know what is the difference