ui: [bug]: Scroll issue on new block sidebar-16
Describe the bug
Hi @Jacksonmills @shadcn Thanks for the blocks, but I have some issue here
- the width when resizing is weird, for some md or other screensize, the content show some weird horizontal scroll
- when content is just short, the block still give me vertical scroll, the remaining I think equal to header height
Here my trial & error
- On first point happen on sidebar-7 to, What do you thing or any best practice, I dont know this is the best practice or not, but I fix using (thanks @rezaafaisal ) :
<div className="[--header-height:calc(theme(spacing.14))]">
<SidebarProvider className="flex flex-col">
<SiteHeader />
<div className="flex flex-1">
<AppSidebar />
<SidebarInset
className={cn(
'w-full',
'peer-data-[state=collapsed]:max-w-[calc(100vw-var(--sidebar-width-icon)-1rem)]',
'peer-data-[state=expanded]:max-w-[calc(100vw-var(--sidebar-width)-1rem)]',
'transition-[width] duration-200 ease-linear'
)}
>
{children}
</SidebarInset>
</div>
</SidebarProvider>
</div>;
- I dont know how to solve, but the scroll still annonying
https://github.com/user-attachments/assets/1ac74947-359d-4ff8-a01e-32a09a530ad6
here the v0 if you want demo https://v0.dev/chat/sidebar-16-TO3dinOZ5o3?b=b_IiiEJQ2DaPR https://kzmjklowe3cyql650pxu.lite.vusercontent.net/dashboard
Affected component/components
sidebar
How to reproduce
https://github.com/user-attachments/assets/1ac74947-359d-4ff8-a01e-32a09a530ad6
here the v0 if you want demo https://v0.dev/chat/sidebar-16-TO3dinOZ5o3?b=b_IiiEJQ2DaPR https://kzmjklowe3cyql650pxu.lite.vusercontent.net/dashboard
Codesandbox/StackBlitz link
No response
Logs
System Info
WSL
Before submitting
- I’ve made research efforts and searched the documentation
- I’ve searched for existing issues
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 18 (5 by maintainers)
Commits related to this issue
- fix(sidebar, sidebar-16): 6651 - Resolve unnecessary vertical scroll Includes "label" in registry dependencies for sidebar-16 components. Adjusts sidebar and sidebar inset dimensions to eliminate unw... — committed to Jacksonmills/ui by Jacksonmills 2 years ago
- fix(sidebar, sidebar-16): 6651 - Resolve unnecessary vertical scroll (#6782) * fix(sidebar, sidebar-16): 6651 - Resolve unnecessary vertical scroll Includes "label" in registry dependencies for side... — committed to shadcn-ui/ui by Jacksonmills 2 years ago
- fix(sidebar, sidebar-16): 6651 - Resolve unnecessary vertical scroll (#6782) * fix(sidebar, sidebar-16): 6651 - Resolve unnecessary vertical scroll Includes "label" in registry dependencies for side... — committed to base-buzz/ui by Jacksonmills 2 years ago
- fix(sidebar, sidebar-16): 6651 - Resolve unnecessary vertical scroll (#6782) * fix(sidebar, sidebar-16): 6651 - Resolve unnecessary vertical scroll Includes "label" in registry dependencies for side... — committed to democrata-labs/loki-ui by Jacksonmills 2 years ago
got rid of vertical scroll by deleting
h-svhfrom Sidebar className andmin-h-svhfrom SidebarInset deletepeer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))]also if you are usingvariant="inset"I’m assuming you’re on tailwind v4 which has some changes to get it to work.
Cool well, this was something i’ve solved already, but you’re on your own.
I’m so sorry, I don’t get the point in your comment @rubixvi , it is very inappropriate you not help or give solution but just comment to ASSUME that when you can first check & re-check the code that I share, you can download my demo code in v0 and check for yourself what version I am using
Here my package.json generated from v0 download, I’m using tailwindcss v3
Hi @shadcn @Jacksonmills I try out your updated code on my local and I can confirm on my scenario this issue has been fixed, thank you for your support, I think this issue can be closed 😃
Thank you so much
It’s merged and can also be seen at https://v4.shadcn.com
@adiramardiani not sure if you saw but there was an update to the v4 example that fixes the horizontal scroll: https://github.com/shadcn-ui/ui/pull/6802#issuecomment-2690092974 (test here: https://v4-git-shadcn-fix-v4-demo-responsive-shadcn-pro.vercel.app/)
thanks @Jacksonmills I won’t be able to open PR for a while so you can take care of it
Just tested it myself… good catch @Graphity! Do you want to open a PR for the fix? I can take care of it too, since I needed to add Label to the dep components anyway.
Let me work on this