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

[bug]: Cannot Modify div with style="min-width:100%;display:table" in ScrollArea Component, Causes Overflow #3833

Closed
2 tasks done
Leon-azerty opened this issue May 27, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Leon-azerty
Copy link

Describe the bug

The ScrollArea component in the shadcn/ui library contains a div element with the style min-width:100%;display:table. This div cannot be modified without directly altering the files in the node_modules directory. As a result, the element takes up the entire width and overflows the screen.

Affected component/components

ScrollArea

How to reproduce

Steps to reproduce the behavior:

Import and use the ScrollArea component from shadcn/ui in a project.
Observe that there is a div with style="min-width:100%;display:table" within the component structure.
Notice that this div causes the component to take up the entire width of the screen and overflow.

page.tsx

<ScrollArea className="@container">
        <GoodMorning />
        <Recommendations />
</ScrollArea>

good-morning.tsx

export default function GoodMorning() {
  return (
    <section
      className={cn(
        'grid max-w-full gap-4 grid-cols-4 grid-rows-2',
      )}
    >
      {list.map((item) => (
        <GridElement title={item.title} src={item.src} key={item.title} />
      ))}
    </section>
  )
}

image
image

Codesandbox/StackBlitz link

https://github.com/leon3108/spotiflex

Logs

No response

System Info

I use Brave as browser

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@Leon-azerty Leon-azerty added the bug Something isn't working label May 27, 2024
@vinitkesh
Copy link

vinitkesh commented May 29, 2024

The link you provided, isn't working for some reason.

I think the repo you are referencing is private.

@Leon-azerty
Copy link
Author

Yes, I have changed the visibility.

@Anton-Cherniuk
Copy link

Same problem

@makotodejima
Copy link

This is an issue with the underlying radix-ui's component ScrollArea.
See the issue in radix-ui: radix-ui/primitives#926 (comment)
There's also a suggested workaround there.

@Leon-azerty
Copy link
Author

I applied these changes : radix-ui/primitives#926 (comment)
and it worked. Thanks you @makotodejima

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants