I understand the frustration of facing this issue, but I was able to find a solution early on when working with flex.
To resolve this problem, simply include either overflow: hidden
or min-height: 0
in the parent element where the scrolling occurs. This method consistently works, especially when you need to set dynamic scroll height for the child element.
I believe this advice will be beneficial to you.
.wrapper{
height: 200px;
background-color: cornflowerblue
}
.card{
max-height: 80%;
}
.scroll-y{
max-height: 100%;
overflow-y: auto;
}
.card-body{
overflow: hidden;
/* Alternatively, you can use */
/* min-height: 0; */
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="wrapper">
<div class="card">
<div class="card-header">
Header
</div>
<div class="card-body d-flex">
<div class="w-30 scroll-y">
Col 1
<br>
More Col 1
<br>
More Col 1
<br>
More Col 1
<br>
More Col 1
</div>
<div class="w-30">
Col 2
</div>
<div class="w-30">
Col 3
</div>
</div>
<div class="card-footer">
Footer
</div>
</div>
</div>