git.iko.soy/typeable/elm-ui
on master help sign in
move placeholder to content area of text input instad of `inFront`
commit4040196fa52c58b54cf4ad5d833b61c0b49dbcb1 authorMatthew Griffith <mdg.griffith@gmail.com> dateWed 3 Jul 2019, 09:09 (7 years ago) parentb17280a
1 file changed+33−28
src/Element/Input.elm+33−28
src/Element/Input.elm+33−28
@@ -909,17 +909,24 @@ textHelper textInput attrs textOptions =
909909 else
910910 redistributed.wrapper
911911 ++ List.filterMap bottomPadding redistributed.parent
912− , case textOptions.placeholder of
912+ ]
913+ )
914+ (Internal.Unkeyed
915+ (if textOptions.text == "" then
916+ case textOptions.placeholder of
913917 Nothing ->
914918 []
915919
916920 Just place ->
917− [ renderPlaceholder place redistributed.cover (textOptions.text == "")
921+ [ renderPlaceholder place
922+ -- redistributed.cover
923+ []
924+ (textOptions.text == "")
918925 ]
919− ]
920− )
921− (Internal.Unkeyed
922− [ Internal.unstyled (Html.text textOptions.text) ]
926+
927+ else
928+ [ Internal.unstyled (Html.text textOptions.text) ]
929+ )
923930 )
924931 ]
925932 )
@@ -936,7 +943,7 @@ textHelper textInput attrs textOptions =
936943 []
937944
938945 Just place ->
939− [ renderPlaceholder place redistributed.cover (textOptions.text == "")
946+ [ Element.inFront (renderPlaceholder place redistributed.cover (textOptions.text == ""))
940947 ]
941948 ]
942949 )
@@ -959,28 +966,26 @@ textHelper textInput attrs textOptions =
959966
960967
961968renderPlaceholder (Placeholder placeholderAttrs placeholderEl) forPlaceholder on =
962− Element.inFront
963− (Element.el
964− (defaultTextPadding
965− :: forPlaceholder
966− ++ [ Font.color charcoal
967− , Internal.htmlClass (classes.noTextSelection ++ " " ++ classes.passPointerEvents)
968− , Border.color (Element.rgba 0 0 0 0)
969− , Background.color (Element.rgba 0 0 0 0)
970− , Element.height Element.fill
971− , Element.width Element.fill
972− , Element.alpha
973− (if on then
974− 1
975−
976− else
977− 0
978− )
979− ]
980− ++ placeholderAttrs
981− )
982− placeholderEl
969+ Element.el
970+ --defaultTextPadding
971+ (forPlaceholder
972+ ++ [ Font.color charcoal
973+ , Internal.htmlClass (classes.noTextSelection ++ " " ++ classes.passPointerEvents)
974+ , Border.color (Element.rgba 0 0 0 0)
975+ , Background.color (Element.rgba 0 0 0 0)
976+ , Element.height Element.fill
977+ , Element.width Element.fill
978+ , Element.alpha
979+ (if on then
980+ 1
981+
982+ else
983+ 0
984+ )
985+ ]
986+ ++ placeholderAttrs
983987 )
988+ placeholderEl
984989
985990
986991{-| Because textareas are now shadowed, where they're rendered twice,