git.iko.soy/typeable/elm-ui
on master help sign in
Placeholders only inherit spatial attributes
a15c655Matthew Griffith
src/Element/Input.elm+19−1
@@ -673,6 +673,21 @@ type Padding
673 = Padding Int Int Int Int
673 = Padding Int Int Int Int
674
674
675
675
676+inheritablePlaceholderAttributes attr =
677+ case attr of
678+ Internal.StyleClass _ (Internal.PaddingStyle _ _ _ _ _) ->
679+ True
680+
681+ Internal.StyleClass _ (Internal.BorderWidth _ _ _ _ _) ->
682+ True
683+
684+ Internal.StyleClass _ (Internal.Transform _) ->
685+ True
686+
687+ _ ->
688+ False
689+
690+
676{-|
691{-|
677
692
678 attributes
693 attributes
@@ -708,6 +723,9 @@ textHelper textInput attrs textOptions =
708 behavior =
723 behavior =
709 [ Internal.Attr (Html.Events.onInput textOptions.onChange) ]
724 [ Internal.Attr (Html.Events.onInput textOptions.onChange) ]
710
725
726+ forPlaceholder =
727+ List.filter inheritablePlaceholderAttributes attributes
728+
711 noNearbys =
729 noNearbys =
712 List.filter (not << forNearby) attributes
730 List.filter (not << forNearby) attributes
713
731
@@ -912,7 +930,7 @@ textHelper textInput attrs textOptions =
912 [ Element.inFront
930 [ Element.inFront
913 (Element.el
931 (Element.el
914 (defaultTextPadding
932 (defaultTextPadding
915− :: noNearbys
933+ :: forPlaceholder
916 ++ [ Font.color charcoal
934 ++ [ Font.color charcoal
917 , Internal.htmlClass (classes.noTextSelection ++ " " ++ classes.passPointerEvents)
935 , Internal.htmlClass (classes.noTextSelection ++ " " ++ classes.passPointerEvents)
918 , Border.color (Element.rgba 0 0 0 0)
936 , Border.color (Element.rgba 0 0 0 0)