Make ScrollablePane work with only maxHeight from parent element
Environment Information
- Package version(s): 5.131.0
- Browser and OS versions: Windows 10, Edge
Please provide a reproduction of the bug in a codepen:
Actual behavior:
<div id='myGeneralContainer'>
<div style={{position:'relative', maxHeight:'300px'}>
<ScrollablePane>
<DetailsList .../>
</ScrollablePane>
</div>
<div>
The details list is not rendered, and actual height of scrollable pane is 0. Nothing is rendered.
Expected behavior:
The details list should take its content height automatically, and if it exceeds 300px only then the scrollbars should appear.
Priorities and help requested:
Are you willing to submit a PR to fix? (Yes, No)
Requested priority: High
Products/sites affected: (if applicable)
You're actually describing the intended behavior of the ScrollablePane itself. Rather than taking the height of the content and using that to decide the height. It uses the height of the parent to determine the height (using the position:absolute;top:0;left:0;right:0;bottom:0 trick). I've made a really simplified version of this scrollable pane and what it actually uses for styling:
https://codepen.io/anon/pen/JxOYZj
This is actually by design. In your scenario, probably best is to use a min-height or specify a height to "reserve" space for ScrollablePane to do its job.
Feel free to fork and modify that codepen to describe what you are expecting. Thanks!
This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fabric React!
hi @kenotron . Thanks for the response. I understand the styling of ScrollablePane.
In my case, i don't know the height, and if i specify min-height, the scrollablepane will always take min-height and will not expand to its actual height. Even in your example of codepen, the content is NOT VISIBLE and the height of ScrollablePane is 0.

I'm going to punt this to feature request at this point.
hi. any updates on this?
Given this is the intended behavior and we don't have current plans to make updates to ScrollablePane I'm going to close this out. If others hit this issue and have more data on why this should get fixed, please feel free to reopen or add additional details