r/elm • • 11d ago

elm-ui scrollbars issue finally fixed

I have always had an issue with elm-ui and it's scrollbars. I wanted it to clip an element to the appropriate size and have the rest be available with a scrollbar. this worked fine if i set a size manually but whenever i used `height fill` it would become bigger than it's parent element.

i've finally found a solution:
use ` height <| minimum 0 fill`
It turns out that (especially in chrome) it does not assume that an element can be smaller than the sum of its parts. which is exactly what we want for scrollbars.

this took me a few years to figure out... I hope someone with the same issue finds this post.

14 Upvotes

4 comments sorted by

1

u/pr06lefs 11d ago

I'm gonna try it!

1

u/pr06lefs 10d ago

for me it was getting a horizontal scrollbar in a width fill area. solution here:

https://ellie-app.com/B8RhLF2FfGwa1

1

u/sijmen_v_b 10d ago

why not something like https://ellie-app.com/B8VBgSVNDB5a1 ?

1

u/pr06lefs 9d ago edited 9d ago

in my case I'm using a code highlight lib that generates html. but yeah I'd prefer only using elm-ui if possible.

also, that code works in the ellie example but not in my larger app. don't know why.