I'm trying to make the central panel a scrollable area (x and y) within a nested flexbox item.
html,
body {
width: 100%;
height: 100%;
margin: 0;
color: #fff;
}
.layout {
display: flex;
align-items: stretch;
flex-wrap: nowrap;
width: 100%;
}
.layout.horizontal {
flex-direction: row;
}
.layout.vertical {
flex-direction: column;
}
.pane {
position: relative;
flex: 1;
}
.fill {
min-height: 100%;
height: 100%;
}
.scrollable {
overflow-x: auto;
overflow-y: auto;
}
.content {
background-color: salmon;
display: flex;
justify-content: center;
align-items: center;
width: 200px;
height: 200px;
}
/* Colour Highlighting */
.layer1 > .pane:nth-child(1) {
background-color: steelblue;
}
.layer1 > .pane:nth-child(2) {
background-color: plum;
}
.layer1 > .pane:nth-child(3) {
background-color: lightsteelblue;
}
.layer2 > .pane:nth-child(1) {
background-color: darkseagreen;
}
.layer2 > .pane:nth-child(2) {
background-color: seagreen;
}
.layer2 > .pane:nth-child(3) {
background-color: lightseagreen;
}
<div class="layout horizontal fill layer1">
<div class="pane">
LEFT
</div>
<div class="pane">
<div class="layout vertical fill layer2">
<div class="pane">
TOP
</div>
<div class="pane scrollable">
<div class="content">CONTENT</div>
</div>
<div class="pane">
BOTTOM
</div>
</div>
</div>
<div class="pane">
RIGHT
</div>
</div>
Note: Expand the sample to full window mode.
In non-nested scenarios the horizontal scrolling works fine for the central panel:
However when nested, the horizontal scrolling for the central panel does not activate as expected. This seems to be the case for Chrome, Firefox and Edge. Funnily enough it works as expected in IE11, which suggests the modern browsers are correctly interpreting some specification unknown to me.
What am I missing?
Update: It seems setting overflow:auto on the outer central column is required. With this it behaves as expected. Why is this?