git.iko.soy/typeable/elm-ui
on master help sign in
fix multiline overflow issue
commit77cde747a1bd823d878dbe45540a3d11e699cddb authorMatthew Griffith <mdg.griffith@gmail.com> dateSun 28 Jul 2019, 10:30 (7 years ago) parent93ce9a2
2 files changed+29−14
src/Element/Input.elm+24−8 src/Internal/Style.elm+5−6
src/Element/Input.elm+24−8
@@ -872,7 +872,7 @@ textHelper textInput attrs textOptions =
872872 _ ->
873873 Nothing
874874
875− heightContent =
875+ heightConstrained =
876876 case textInput.type_ of
877877 TextInputNode inputType ->
878878 False
@@ -882,7 +882,7 @@ textHelper textInput attrs textOptions =
882882 |> List.filterMap getHeight
883883 |> List.reverse
884884 |> List.head
885− |> Maybe.map isShrink
885+ |> Maybe.map isConstrained
886886 |> Maybe.withDefault False
887887
888888 parentPadding =
@@ -950,18 +950,16 @@ textHelper textInput attrs textOptions =
950950 Internal.element
951951 Internal.asEl
952952 Internal.div
953− ((if heightContent then
954− [ Element.width Element.fill
955− , Internal.htmlClass classes.focusedWithin
956− ]
953+ ((if heightConstrained then
954+ (::) Element.scrollbarY
957955
958956 else
957+ identity
958+ )
959959 [ Element.width Element.fill
960960 , Internal.htmlClass classes.focusedWithin
961− , Element.scrollbarY
962961 , Internal.htmlClass classes.inputMultilineWrapper
963962 ]
964− )
965963 ++ redistributed.parent
966964 )
967965 (Internal.Unkeyed
@@ -1190,6 +1188,24 @@ isShrink len =
11901188 isShrink l
11911189
11921190
1191+isConstrained len =
1192+ case len of
1193+ Internal.Content ->
1194+ False
1195+
1196+ Internal.Px _ ->
1197+ True
1198+
1199+ Internal.Fill _ ->
1200+ True
1201+
1202+ Internal.Min _ l ->
1203+ isConstrained l
1204+
1205+ Internal.Max _ l ->
1206+ True
1207+
1208+
11931209isPixel len =
11941210 case len of
11951211 Internal.Content ->
src/Internal/Style.elm+5−6
@@ -1567,20 +1567,19 @@ baseSheet =
15671567 -- Get this.
15681568 -- This allows multiline input to anchor scrolling to the bottom of the node
15691569 -- when in a scrolling viewport, and the user is adding content.
1570+ -- however, it only works in chrome. In firefox, it prevents scrolling.
15701571 --
1571− -- How crazy is this solution?
1572+ -- But how crazy is this solution?
15721573 -- [ Prop "display" "flex"
15731574 -- , Prop "flex-direction" "column-reverse"
15741575 -- ]
1575− [ Descriptor "::after"
1576− [ Prop "content" "''"
1577− , Prop "overflow-anchor" "auto"
1578− ]
1576+ [ -- to increase specificity to beat another rule
1577+ Descriptor (dot classes.single)
1578+ [ Prop "flex-basis" "auto" ]
15791579 ]
15801580 , Descriptor (dot classes.inputMultilineParent)
15811581 [ Prop "white-space" "pre-wrap"
15821582 , Prop "cursor" "text"
1583− , Prop "overflow-anchor" "none"
15841583 , Child (dot classes.inputMultilineFiller)
15851584 [ Prop "white-space" "pre-wrap"
15861585 , Prop "color" "transparent"