git.iko.soy/typeable/elm-ui
on master help sign in
move placeholder to content area of text input instad of `inFront`
4040196Matthew Griffith
src/Element/Input.elm+33−28
@@ -909,17 +909,24 @@ textHelper textInput attrs textOptions =
909 else
909 else
910 redistributed.wrapper
910 redistributed.wrapper
911 ++ List.filterMap bottomPadding redistributed.parent
911 ++ List.filterMap bottomPadding redistributed.parent
912+ ]
913+ )
914+ (Internal.Unkeyed
915+ (if textOptions.text == "" then
912− , case textOptions.placeholder of
916+ case textOptions.placeholder of
913 Nothing ->
917 Nothing ->
914 []
918 []
915
919
916 Just place ->
920 Just place ->
917− [ renderPlaceholder place redistributed.cover (textOptions.text == "")
921+ [ renderPlaceholder place
922+ -- redistributed.cover
923+ []
924+ (textOptions.text == "")
918 ]
925 ]
919− ]
926+
920− )
927+ else
921− (Internal.Unkeyed
922− [ Internal.unstyled (Html.text textOptions.text) ]
928+ [ Internal.unstyled (Html.text textOptions.text) ]
929+ )
923 )
930 )
924 ]
931 ]
925 )
932 )
@@ -936,7 +943,7 @@ textHelper textInput attrs textOptions =
936 []
943 []
937
944
938 Just place ->
945 Just place ->
939− [ renderPlaceholder place redistributed.cover (textOptions.text == "")
946+ [ Element.inFront (renderPlaceholder place redistributed.cover (textOptions.text == ""))
940 ]
947 ]
941 ]
948 ]
942 )
949 )
@@ -959,28 +966,26 @@ textHelper textInput attrs textOptions =
959
966
960
967
961renderPlaceholder (Placeholder placeholderAttrs placeholderEl) forPlaceholder on =
968renderPlaceholder (Placeholder placeholderAttrs placeholderEl) forPlaceholder on =
962− Element.inFront
969+ Element.el
963− (Element.el
964− (defaultTextPadding
970+ --defaultTextPadding
965− :: forPlaceholder
971+ (forPlaceholder
966− ++ [ Font.color charcoal
972+ ++ [ Font.color charcoal
967− , Internal.htmlClass (classes.noTextSelection ++ " " ++ classes.passPointerEvents)
973+ , Internal.htmlClass (classes.noTextSelection ++ " " ++ classes.passPointerEvents)
968− , Border.color (Element.rgba 0 0 0 0)
974+ , Border.color (Element.rgba 0 0 0 0)
969− , Background.color (Element.rgba 0 0 0 0)
975+ , Background.color (Element.rgba 0 0 0 0)
970− , Element.height Element.fill
976+ , Element.height Element.fill
971− , Element.width Element.fill
977+ , Element.width Element.fill
972− , Element.alpha
978+ , Element.alpha
973− (if on then
979+ (if on then
974− 1
980+ 1
975−
981+
976− else
982+ else
977− 0
983+ 0
978− )
984+ )
979− ]
985+ ]
980− ++ placeholderAttrs
986+ ++ placeholderAttrs
981− )
982− placeholderEl
983 )
987 )
988+ placeholderEl
984
989
985
990
986{-| Because textareas are now shadowed, where they're rendered twice,
991{-| Because textareas are now shadowed, where they're rendered twice,