Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h-screen class causes page jump when using shadcn datatable pagination. #806

Open
braginteractive opened this issue Jul 25, 2024 · 2 comments

Comments

@braginteractive
Copy link
Contributor

Just thought I would share an issue for anyone that might run into the same problem.

I am using the shadcn datatable and pagination.

In the root.tsx file, the parent div around the Outlet is using h-screen

	<div className="flex h-screen flex-col justify-between">

				<div className="flex-1">
					<Outlet />
				</div>

				<div className="container flex justify-between pb-5">
					<Logo />
					<ThemeSwitch userPreference={data.requestInfo.userPrefs.theme} />
				</div>
			</div>

With the h-screen the Select component that is used in the datatable pagination doesnt work properly. When clicked, the page jumps to the top.

Removing the h-screen fixed the issue for me.

@andrecasal
Copy link
Contributor

@braginteractive replace h-screen with min-h-screen instead.

In addition, for the pages that render inside the root's <Outlet />, I set the header and footer heights as CSS variables and determine that container's min-height like so: min-h-[calc(100vh-var(--header-height)-var(--footer-height))].

This ensures the minimum height of that container is your viewport's height - header height - footer height, ensuring your footer will always show correctly if the content is smaller than your viewport.

@kentcdodds
Copy link
Member

I'm definitely open to a PR to fix this! Thanks for reporting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants