We have a div element with lots of sub elements and this is not displaying correctly in latest Chrome (79) on Mac. We are getting two scrollbars and it looks like the list is taking up too much space and forcing the titlePanel and actionPanel out of the viewport. See screenshots. We want the UI to take up the full height of the browser window, and we want the list element to take up remaining space and have a scrollbar inside it.
Correct:
Not correct (notice the two blue panels and the two scroll bars):
This used to work fine up till Chrome 78 and is still working fine in latest Safari on Mac. We have also tested on Chrome/Safari on latest iOS and here it also works. It does NOT work on latest Chrome on Mac and on Samsung S10, so we expect that the latest update of Chrome has introduced some changes.
However, I'm not completely sure that our HTML/CSS is correct. We are able to fix the issue by adding overflow-y:auto to the contentPanel, but I expected the overflow on the list element to be sufficient (which was the case until latest Chrome update).
Is our HTML/CSS bad or is there an issue with latest Chrome?
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
min-height: 100%;
}
.container {
width: 100%;
height: 100%;
}
.mainPanel {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: stretch;
background: blue;
}
.contentPanel {
flex: 1 1 auto;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
height: 100%;
/*overflow-y:auto*/;
}
.titlePanel {
flex: 0 0 auto;
}
.actionPanel {
flex: 0 0 auto;
}
.list {
height:100%;
overflow-y:auto;
background:tomato;
}
<div class="container">
<div class="mainPanel">
<div class="contentPanel">
<div class="titlePanel">TITLE</div>
<div class="list">
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
<div>entry</div>
</div>
</div>
<div class="actionPanel">Actions</div>
</div>
</div>