You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem I faced was being unable to truncate text based on the scrollarea component's parent width constraint. Below is a video example, and minimal code to reproduce.
Upon some debugging I found that the source of the issue is that the ScrollAreaPrimitive.Content element is manually styled with display:table (and min-width: 100%). This breaks the flex/w-full chain I was using to constrain width.
Upon changing the content element (tagged with 'data-melt-scroll-area-content') to display:flex, I get the desired effect.
When I try to overwrite this in the component:
It gets overwritten by those manual styles:
Is the display:table necessary? From first glance it doesn't seem to be needed.
If not, how would I proceed to overwrite these default styles?
P.S. I've had trouble with the obfuscated bits-ui (and even lower-level melt-ui) parts a few times now, maybe I am thinking about it wrong. If I look at the docs for the melt-ui scroll-area here here I can't see those styles being applied either. Could you maybe elaborate on when I would need to reach into melt-ui components? From my perspective your shadcn port is already pretty damn robust.
P.P.S Big congratulations on the work you've put out for the Svelte ecosystem.
Reproduction
The top is using normal 'overflow-auto' container, the bottom is using the scroll-area component.
flex_w-full.mp4
<script>
importScrollAreafrom"$lib/components/ui/scroll-area/scroll-area.svelte";
</script>
<divclass="flex h-full w-full flex-col items-center justify-center gap-5">
<!-- 1. using simple overflow container -->
<divclass="h-64 w-64 overflow-auto">
{#eachnewArray(20) ?? [] as_}
<divclass="flex w-full flex-row bg-red-100">
<divclass="flex w-12 bg-orange-300">
<spanclass="truncate">Lorem ipsum dolor sit amet consectetur adipisicing elit.</span>
</div>
<divclass="flex min-w-0 grow bg-green-300">
<spanclass="truncate">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facere unde quisquam illum ipsa dolor modi est
itaque temporibus ea. Maiores fugit facilis quo consectetur vitae est vel laborum praesentium.
</span>
</div>
<divclass="flex min-w-0 text-nowrap bg-purple-300">
<spanclass="truncate">Lorem ipsum dolor sit amet consectetur adipisicing elit.</span>
</div>
</div>
{/each}
</div>
<!-- 2. Using Scroll area -->
<ScrollAreaclass="h-64 w-64">
{#eachnewArray(20) ?? [] as_}
<divclass="flex w-full flex-row bg-red-100">
<divclass="flex w-12 bg-orange-300">
<spanclass="truncate">Lorem ipsum dolor sit amet consectetur adipisicing elit.</span>
</div>
<divclass="flex min-w-0 grow bg-green-300">
<spanclass="truncate">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum facere unde quisquam illum ipsa dolor modi est
itaque temporibus ea. Maiores fugit facilis quo consectetur vitae est vel laborum praesentium.
</span>
</div>
<divclass="flex min-w-0 text-nowrap bg-purple-300">
<spanclass="truncate">Lorem ipsum dolor sit amet consectetur adipisicing elit.</span>
</div>
</div>
{/each}
</ScrollArea>
</div>
Describe the bug
The problem I faced was being unable to truncate text based on the scrollarea component's parent width constraint. Below is a video example, and minimal code to reproduce.
Upon some debugging I found that the source of the issue is that the ScrollAreaPrimitive.Content element is manually styled with
display:table
(and min-width: 100%). This breaks the flex/w-full chain I was using to constrain width.Upon changing the content element (tagged with 'data-melt-scroll-area-content') to display:flex, I get the desired effect.
When I try to overwrite this in the component:
It gets overwritten by those manual styles:
P.S. I've had trouble with the obfuscated bits-ui (and even lower-level melt-ui) parts a few times now, maybe I am thinking about it wrong. If I look at the docs for the melt-ui scroll-area here here I can't see those styles being applied either. Could you maybe elaborate on when I would need to reach into melt-ui components? From my perspective your shadcn port is already pretty damn robust.
P.P.S Big congratulations on the work you've put out for the Svelte ecosystem.
Reproduction
The top is using normal 'overflow-auto' container, the bottom is using the scroll-area component.
flex_w-full.mp4
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: