From cbed97f22f9f78a058b2978bbd89f623fb8b4aec Mon Sep 17 00:00:00 2001 From: Tomas Zemanovic Date: Wed, 16 May 2018 14:51:45 +1000 Subject: [PATCH] move event handlers onto the toggle elements --- src/Material/Toggles.elm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Material/Toggles.elm b/src/Material/Toggles.elm index 9f8548f..7f98a0a 100644 --- a/src/Material/Toggles.elm +++ b/src/Material/Toggles.elm @@ -181,9 +181,6 @@ top lift kind model summary elems = , cs "is-upgraded" , cs "is-checked" |> when cfg.value , cs "is-focused" |> when model.isFocused - , Internal.on1 "focus" lift (SetFocus True) - , Internal.on1 "blur" lift (SetFocus False) - , Internal.attribute <| blurOn "mouseup" ] (List.concat [ elems @@ -212,6 +209,9 @@ viewCheckbox lift model config elems = [ cs "mdl-checkbox__input" , Internal.attribute <| type_ "checkbox" , Internal.attribute <| checked summary.config.value + , Internal.on1 "focus" lift (SetFocus True) + , Internal.on1 "blur" lift (SetFocus False) + , Internal.attribute <| blurOn "mouseup" ] [] , span [ class ("mdl-checkbox__label") ] elems @@ -239,6 +239,9 @@ viewSwitch lift model config elems = [ cs "mdl-switch__input" , Internal.attribute <| type_ "checkbox" , Internal.attribute <| checked summary.config.value + , Internal.on1 "focus" lift (SetFocus True) + , Internal.on1 "blur" lift (SetFocus False) + , Internal.attribute <| blurOn "mouseup" ] [] , span [ class "mdl-switch__label" ] elems @@ -263,6 +266,9 @@ viewRadio lift model config elems = [ cs "mdl-radio__button" , Options.attribute <| type_ "radio" , Options.attribute <| checked summary.config.value + , Internal.on1 "focus" lift (SetFocus True) + , Internal.on1 "blur" lift (SetFocus False) + , Internal.attribute <| blurOn "mouseup" ] [] , span [ class "mdl-radio__label" ] elems