git.iko.soy/typeable/elm-ui
on master help sign in
resolves #61 - While chrome has a minimum line-height of 1.05em on text inputs, which was making the math be slightly off forcomparison to normal `els`, we can come back to sanity by setting height as well as line-height
commit37bd5b70efe7860df1f9be0543fc0cff14ada229 authorMatthew Griffith <mdg.griffith@gmail.com> dateThu 4 Jul 2019, 10:55 (7 years ago) parentec1f303
1 file changed+10−5
src/Element/Input.elm+10−5
src/Element/Input.elm+10−5
@@ -863,9 +863,7 @@ textHelper textInput attrs textOptions =
863863 ++ (case textInput.type_ of
864864 TextInputNode inputType ->
865865 [ Internal.Attr (Html.Attributes.type_ inputType)
866− , Internal.htmlClass (classes.inputText ++ " " ++ classes.inputMultiline)
867−
868− -- , Internal.htmlClass "focusable"
866+ , Internal.htmlClass classes.inputText
869867 ]
870868
871869 TextArea ->
@@ -1179,11 +1177,18 @@ redistributeOver isMultiline stacked attr els =
11791177
11801178 else
11811179 let
1180+ newHeight =
1181+ Element.htmlAttribute
1182+ (Html.Attributes.style
1183+ "height"
1184+ ("calc(1.0em + " ++ String.fromInt (2 * min t b) ++ "px)")
1185+ )
1186+
11821187 newLineHeight =
11831188 Element.htmlAttribute
11841189 (Html.Attributes.style
11851190 "line-height"
1186− ("calc(1.05em + " ++ String.fromInt (2 * min t b) ++ "px)")
1191+ ("calc(1.0em + " ++ String.fromInt (2 * min t b) ++ "px)")
11871192 )
11881193
11891194 reducedVerticalPadding =
@@ -1196,7 +1201,7 @@ redistributeOver isMultiline stacked attr els =
11961201 in
11971202 { els
11981203 | parent = reducedVerticalPadding :: els.parent
1199− , input = newLineHeight :: els.input
1204+ , input = newHeight :: newLineHeight :: els.input
12001205 , cover = attr :: els.cover
12011206 }
12021207