Include padding bottom when overflow-y-scroll
I have an element that needs to be scrollable. Specifically, this element is the parent element that encapsulates all elements bar my sidebar (im using nextjs, this element is element that encapsulates children in the root layout).
I would like that when the element is scrolled, that the bottom padding is also included in the scroll, e.g if we were to scroll all the way down the page, the bottom padding on the element should be visible. Currently, when we scroll all the way down the element, the page cuts off before the bottom padding is displayed. (In the image attached, I have scroll the page all the way down)
RootLayout:
24 Replies
hi
i think the problem is with the padding
by some reason, the padding is not being applied on the element
is the padding that divides the aside with the main content caused by this?
you can check it with the devtools
yeah it looks to me that this is the case. Is there anything you could suggest to maybe fix the issue?
sorry for the late reply! I think it may be that you are setting the height of the first container to 100vh, but the overflow-y-auto is being set on the second container.
the overflow-y-auto is set on the child, but the ovrflow is going to happen on the parent that has the h-screen
I see I see, that makes sense. I’ve just this second powered down my computer for the night - but I’ll implement this change tommorow and get back to you. Hopefully it results in the behaviour I’m after. Appreciate your time!
Made the changes - the padding does not seem to be visible. It also makes my side nav bar not cover the whole span of the page, although im pretty sure i could fix that.
Ive attached an image of what the screen looks like with this change (scrolled all the way down).
Its hard to debug by message, do you have it on a repository so i can download it and run it?
Very true. Here's the repo in question. It does have a tiny bit of setup required with a couple of env variables, but you may just be able to delete the
env.js
file and omit this, although I think if you do this things might play up a bit. Nonetheless, if you dont fancy filling the env variables, you can simply extract the jsx as it is the very top level layout.tsx in question.
https://github.com/FlynnHillier/chessalyze
layout.tsx
https://github.com/FlynnHillier/chessalyze/blob/main/src/app/layout.tsxI'm getting this error
i cloned the repo, installed dependencies and the cli asked to run
next-ws-cli@latest patch
and I acceptedI've had that error a couple of times - I usually have to resolve it by removing and reinstalling a certain dependency after adding another dependency. I'm pretty sure its an error in a the
node-canvas
module which one of my dependencies depends on. I'll look into fixing it tommorow, or atleast within the next couple of days, and get back to you;
if you want to try if it 'fixes' it for you trying yarn remove @flynnhillier/chessboard-image-gen
and then re-add it. After installing all other things.it works
the main page has a "use server". be careful, idk if this is fine, because i havent worked with sockets, but use server is usually for server actions, not for defining server side components.
i could not run the hole aplication, so i just replaced the actual game with a div. it works fine
the error might be because of the display of this box
i cant find this component, could you tell me which file it is in?
Thanks for taking a look man. Appreciate it. The
Panel
component is stored at src/app/(dynamic)/(protected)/play/(panel)/_components/Panel.tsx
.
https://github.com/FlynnHillier/chessalyze/blob/main/src/app/(dynamic)/(protected)/play/(panel)/_components/Panel.tsx
also - wow ok that is strange.
I've got exams in a couple of days so cant really spare the time to play around with the code myself right now. I do really appreciate you taking the time to help me out.dont worry, when you have some free time, send a message and we get back to it
🙏 will do. Thanks. I finish in just over a week.
hey bro - long time I know. Finally back to normal - you still able to lend a helping hand in getting this resolved? < 3
hi
sure
Thanks mate, appreciate it.
Here is the styling of this component. It doesn't look to me like it has anything that would cause the padding of the body not to show. Interestingly I just tried adding a margin bottom to the component and visually it looks as I want it to. If we can't come up with a better solution I can hackily fix it like that.
i think its better to fix it fast rather than spending so much time trying to debug it
better to continue working on the proejct
but
can i set it up on my machine? do you have deplyoed it somewhere?
I have it hosted on github still, but its not deployed anywhere. You can host it yourself locally, but it requires a set of google oauth credentials to work properly & a postgres db url. I dont think you'll be able to access that page without doing some finicky stuff without that.
the google auth credentials are the hard part haha