It has been a quite while... determining the length of the content you are scrolling and the size of your viewport was a challenge as well that catching every event that could change the position of the viewport or generally handling input.
It was implemented in C for a small display for debugging controller for a µC. It did take quite even without any dynamic content for something we take for granted. And in the end it still was pretty clunky.
I believe that browsers still disallow customizing scrollbars and there are countless examples of people having build their own scrollbars to replace them. Many of those are quite wonky, so that calms me down at least.
I guess it's one of those things we take for granted now and thus you think that it can't be that hard to create... and then you try to do so and you realize how complex some things really are.
So you piqued my curiosity. What are some examples of those non-trivial things?