In the past I have achieved a scrolling column, bounded by a header, a footer, or both, by playing with the attributes until it worked. Much better than this would be to have a minimum working example, that I understood, that I could copy.
module Main exposing (..)
import Html exposing (Html)
import Element exposing (..)
main : Html msg
main =
layout [ height fill ] <|
row [ height fill ]
[ chatPanel
]
displayList = List.map
(\i -> el [] <| text <| String.fromInt i)
(List.range 100000 100100)
chatPanel : Element msg
chatPanel =
let
header = el [] <|
text "Header"
messagePanel =
-- Workaround: set min height of 0 to override column sizing to content
column [ height <| minimum 0 fill
, scrollbarY
] <|
displayList
footer = el [ alignBottom
, clipY
] <|
text "Footer"
in
column [ height fill ]
[ header
, messagePanel
, footer
]
I kept the row inside layout because we probably all have a structure something like that.
I have two questions:
What does the height <| minimum 0 fillworkaround do? I don’t understand the comment.
If I don’t clipY the footer, I end up with a vertical scrollbar over the whole ‘page’.
a) Why does this happen?
b) Is there a better solution than clipY?
Unfortunately, your style version doesn’t work (easier to see in Chrome/Chromium as the scrollbars are permanent, unlike Firefox where they are very thin and fade away). And neither does my property version — except in Chromium it’s now worse
And why did you remove alignBottom from the footer?
Both CSS and JS have properties. You can set a CSS property on an element in Elm using Html.Attributes.style. You can set a JS property on an element in Elm using Html.Attributes.property.
For me, the Ellie looks the same in Chrome and Firefox, and very similar to what it looked like with your original code. I’m not sure what you mean. You probably need to post screenshots of your desired and actual look.
What I wrote above above CSS and JS properties explains this.
Because it doesn’t do anything. The scrollable area has height fill and pushes the footer down.
Screenshots to explain what I want and what I get.
This is what I want.
It’s what I get with the code in my original post in this thread: withclipY in the footer (but without the unnecessary alignBottom in the footer)
This is also what I don’t want.
It’s what I see in your Ellie, Simon: https://ellie-app.com/vqWh8mc8qVLa1
Thank you, but it doesn’t work for me in desktop (Ubuntu) Chromium or Firefox.
It’s essentially the same as the one above: unwanted Y scrollbar over the whole page.
My guess is that there’s something funky going on with line-height that overflows a pixel or two when all the boxes are sized exactly to their text. Text is weird in CSS, and elm-ui does a lot of weird stuff to work around that and it’s not perfect.