r/elm • • Oct 13 '26

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.

15 Upvotes

4 comments sorted by

1

u/pr06lefs Oct 13 '26

I'm gonna try it!

1

u/pr06lefs Oct 14 '26

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 Oct 15 '26

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

1

u/pr06lefs Oct 15 '26 edited Oct 15 '26

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.