-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ScrollArea doesn't work in a dynamic height container #724
Comments
It works fine, you just need to remove a wrapper div – https://codesandbox.io/s/vigilant-roentgen-j4f9y?file=/src/Content.tsx |
Why the wrapper div needs to be removed? on nested container, I can't make it work locally? |
I don't know, this is just how ScrollArea works
It should not be different from the example that I've provided in sandbox. We have the same logic in Navabar.Section component and Select/MultiSelect dropdowns, it works fine. |
If you have any other questions, feel free to ask them here or on Discord |
Hi, sorry for digging into the closed issue. <Card>
<Card.Section>
// ...
</Card.Section>
// Relative wrapper
<div style={{ position: "relative", height: "100%" }}>
// Absolute scrollarea div, adjust the 0s if needed
<ScrollArea style={{ position: "absolute", top: 0, bottom: 0, left: 0, right: 0 }}>
{
// mapping func
}
</ScrollArea>
</div>
</Card> It may not be an elegant solution, but hope it helps someone who encountered this problem. |
I can't get |
Tabs.Tab is not different from any other content, ScrollArea works fine – https://codesandbox.io/s/inspiring-gauss-7nphy3?file=/src/App.tsx |
Okay, let me clarify. I can get it to work with a set height, but I want it to take up 100% of it's parent and scroll in that. Setting height to Tab 1 has a |
@rtivital Any ideas on this ^? |
I've provided all examples I had, the general approach is to wrap ScrollArea in flex container and setting |
@rtivital I've been working with a variety of different components over the last two weeks and everything else has worked without issue. The ONLY problematic component I've used in ScrollArea. I absolutely no matter what I do CANNOT get it to work with dynamic height content despite the working example above. Wrapping it in a flex container and setting And I just ran into another issue where it doesn't let you scroll if you set maxHeight instead of height which makes no sense to me. In this case, it just simply doesn't allow for scrolling at all. See updated code sandbox for examples: The issue isn't just with Tabs.Tab or anything else specific, it's with ScrollArea itself, it simply doesn't seem to work in most cases. |
Scrollarea works fine, you just did not put it in flex container. |
The secret ingredient is setting the calulated height of the above flex container which is an extremely important missed detail!
But it works! So all is good even if it took a good week to get there! |
Side note: I think the docs should be updated with an example like this |
|
Here's another piece for you. It looks like the above problems were solved by adding My problem is that I want to have a ScrollArea within a dropdown that contains both a header (search bar, etc) and a footer (control / submit buttons), but I don't want to set a fixed height because the content in |
This question on Stack Overflow yielded a solution that helped me. Checkout the JS Fiddle Example here. To solve my problem, I removed
Now I can scroll that middle container with the header above and footer below staying in place. |
@paulgpeterson We provide |
Max Height works fine when you wrap the |
Is Nowhere in the documentation does it state this. |
There is a usage example in documentation |
How can I use AutoSize in Prism? I want to make the prism width grow when the parent is flexGrow: 1 or height: 100%. View width work well but i can't use view width in react-markdown componet render.Is there any way to solve this problem. Thanks! |
For anyone who is curious how to achieve <ScrollArea
w="min-content"
maw="100%">
...
</ScrollArea> P.S. Thanks to Mantine team for adding |
What package has an issue
@mantine/core
Describe the bug
ScrollArea
doesn't work in a flex container when the parent isflexGrow: 1
orheight: 100%
In which browser did the problem occur
Chrome
If possible, please include a link to a codesandbox with the reproduced problem
https://codesandbox.io/s/eloquent-margulis-d7pv7?file=/src/Content.tsx
Do you know how to fix the issue
No
Are you willing to participate in fixing this issue and create a pull request with the fix
No response
Possible fix
No response
The text was updated successfully, but these errors were encountered: