Here's how I would do it: onShiftClick : msg -> Attribute msg onShiftClick message = let hasShift shiftKey = if shiftKey then JD.succeed message else JD.fail "No shift key" in on "click" <| JD.andThen hasShift <| JD.at [ "shiftKey" ] JD.bool
More or less adapted from the TodoMVC app (which Json-fails on any other keycode than 13) Working example on: https://runelm.io/c/6mf -- 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.