@@ -856,6 +856,14 @@ textHelper textInput attrs textOptions =
861+ Internal.Height h ->
859 isHeightContent attr =
867 isHeightContent attr =
860 case attr of
868 case attr of
861 Internal.Height Internal.Content ->
869 Internal.Height Internal.Content ->
@@ -864,16 +872,18 @@ textHelper textInput attrs textOptions =
867− bottomPadding attr =
875+ getPadding attr =
868 case attr of
876 case attr of
869 Internal.StyleClass cls (Internal.PaddingStyle pad t r b l) ->
877 Internal.StyleClass cls (Internal.PaddingStyle pad t r b l) ->
870− Just <|
878+ -- The - 3 is here to prevent accidental triggering of scrollbars
871− Element.paddingEach
879+ -- when things are off by a pixel or two.
872− { top = 0
880+ -- (or at least when the browser *thinks* it's off by a pixel or two)
882+ { top = max 0 (floor (toFloat t - 3))
873− , right = 0
883+ , right = max 0 (floor (toFloat r - 3))
874− , bottom = b
884+ , bottom = max 0 (floor (toFloat b - 3))
875− , left = 0
885+ , left = max 0 (floor (toFloat l - 3))
@@ -884,7 +894,24 @@ textHelper textInput attrs textOptions =
886 TextArea ->
896 TextArea ->
898+ |> List.filterMap getHeight
901+ |> Maybe.map ((==) Internal.Content)
902+ |> Maybe.withDefault False
887− List.any isHeightContent withDefaults
905+ withDefaults
906+ |> List.filterMap getPadding
909+ |> Maybe.withDefault
889 inputElement =
916 inputElement =
890 Internal.element
917 Internal.element
@@ -910,6 +937,9 @@ textHelper textInput attrs textOptions =
910 , Element.height Element.fill
937 , Element.height Element.fill
911 , Internal.htmlClass classes.inputMultiline
938 , Internal.htmlClass classes.inputMultiline
912 , calcMoveToCompensateForPadding withDefaults
939 , calcMoveToCompensateForPadding withDefaults
940+ , Element.paddingEach parentPadding
941+ , Internal.Attr (Html.Attributes.style "margin" (renderBox (negateBox parentPadding)))
942+ , Internal.Attr (Html.Attributes.style "box-sizing" "content-box")
915 ++ [ value textOptions.text
945 ++ [ value textOptions.text
@@ -932,10 +962,17 @@ textHelper textInput attrs textOptions =
932 Internal.element
962 Internal.element
933 Internal.asEl
963 Internal.asEl
934 Internal.div
964 Internal.div
965+ ((if heightContent then
966+ [ Element.width Element.fill
967+ , Internal.htmlClass classes.focusedWithin
935− ([ Element.width Element.fill
971+ [ Element.width Element.fill
972+ , Internal.htmlClass classes.focusedWithin
936− , Element.scrollbarY
973+ , Element.scrollbarY
937− , Internal.htmlClass classes.focusedWithin
974+ ]
939 ++ redistributed.parent
976 ++ redistributed.parent
941 (Internal.Unkeyed
978 (Internal.Unkeyed
@@ -946,14 +983,7 @@ textHelper textInput attrs textOptions =
946 :: Element.height Element.fill
983 :: Element.height Element.fill
947 :: Element.inFront inputElement
984 :: Element.inFront inputElement
948 :: Internal.htmlClass classes.inputMultilineParent
985 :: Internal.htmlClass classes.inputMultilineParent
950− [ if heightContent then
951− redistributed.wrapper
986+ :: redistributed.wrapper
954− redistributed.wrapper
955− ++ List.filterMap bottomPadding redistributed.parent
958 (Internal.Unkeyed
988 (Internal.Unkeyed
959 (if textOptions.text == "" then
989 (if textOptions.text == "" then
@@ -1009,6 +1039,25 @@ textHelper textInput attrs textOptions =
1009 wrappedInput
1039 wrappedInput
1043+ { top = negate box.top
1044+ , right = negate box.right
1045+ , bottom = negate box.bottom
1046+ , left = negate box.left
1050+renderBox { top, right, bottom, left } =
1053+ ++ String.fromInt right
1055+ ++ String.fromInt bottom
1057+ ++ String.fromInt left
1012renderPlaceholder (Placeholder placeholderAttrs placeholderEl) forPlaceholder on =
1061renderPlaceholder (Placeholder placeholderAttrs placeholderEl) forPlaceholder on =
1013 Element.el
1062 Element.el
1014 (forPlaceholder
1063 (forPlaceholder