I have a single-page-app that uses elm-lang/navigation. I’ve noticed that the 
following behaves oddly because of event propagation:

     [a [ class linkClass
        , style linkStyle
        , href "#" 
        , Events.onClick msg
        ]

That caused me to write this `click` handler to use instead of `Events.onClick`:

onClickWithoutPropagation msg = 
  Events.onWithOptions "click"
    { stopPropagation = False
    , preventDefault = True
    }
    (Json.succeed msg)

That’s not a problem, now that I know about it, but I was surprised that the 
documentation didn’t mention the need - if it’s truly required. So I suspect 
I’m doing something wrong. Am I?

———

For reference, the code directory is 
https://github.com/marick/eecrit/tree/afd8a19958214fb40746842b5080faad414b799a/web/elm/Animals
 
<https://github.com/marick/eecrit/tree/354ce535cae01720a5e870c1f23d72d7e67a225e/web/elm/Animals>
 and the code linked above is at 
https://github.com/marick/eecrit/blob/afd8a19958214fb40746842b5080faad414b799a/web/elm/Pile/Bulma.elm#L23
 
<https://github.com/marick/eecrit/blob/afd8a19958214fb40746842b5080faad414b799a/web/elm/Pile/Bulma.elm#L23>
 and 
https://github.com/marick/eecrit/blob/afd8a19958214fb40746842b5080faad414b799a/web/elm/Pile/HtmlShorthand.elm#L9
 
<https://github.com/marick/eecrit/blob/afd8a19958214fb40746842b5080faad414b799a/web/elm/Pile/HtmlShorthand.elm#L9>
 

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to