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

Temporary fix for #166 #193

Merged
merged 1 commit into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/Demo/Textfields.elm
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ textfields model =
"""
)

, ( "Multi-line textfield with character limit"
, ( "Multi-line textfield with character limit (focused: " ++ (toString model.focus5) ++ ")"
, Html.div []
[ Textfield.render Mdl [8] model.mdl
[ Textfield.label ("Multiline textfield (" ++
Expand Down
11 changes: 6 additions & 5 deletions src/Material/Textfield.elm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ on event decoder =
(\config ->
{ config |
listeners = config.listeners ++ [(Html.Events.on event decoder)]})


{-| Message to dispatch on input
-}
Expand All @@ -202,14 +203,14 @@ onInput f =
-}
onBlur : m -> Property m
onBlur f =
on "blur" (Decoder.succeed f)
on "focusout" (Decoder.succeed f)


{-| The `focus` event occurs when the input gets focus.
-}
onFocus : m -> Property m
onFocus f =
on "focus" (Decoder.succeed f)
on "focusin" (Decoder.succeed f)


{-| Set properties on the actual `input` element in the Textfield.
Expand Down Expand Up @@ -378,9 +379,7 @@ view lift model options =
, if config.disabled then cs "is-disabled" else nop
]
( List.filterMap identity
([ Just <| Html.Events.on "focusin" (Decoder.succeed (lift Focus))
, Just <| Html.Events.on "focusout" (Decoder.succeed (lift Blur))
, defaultInput
([ defaultInput
])
)
[ Options.styled' elementFunction
Expand All @@ -390,6 +389,8 @@ view lift model options =
]
([ Html.Attributes.disabled config.disabled
, Html.Attributes.autofocus config.autofocus
, Html.Events.on "focus" (Decoder.succeed (lift Focus))
, Html.Events.on "blur" (Decoder.succeed (lift Blur))
] ++ textValue ++ typeAttributes ++ maxlength ++ listeners)
[]
, Html.label
Expand Down