I can't believe that no one has noticed this before but I can't seem to find anyone that has noticed this behaviour. I should start off by saying that the html for this was written a long time ago (not by me) and can't really be modified at the moment.
So here is the problem:
We have html structured laid out like this
.rptDisplay {
overflow: auto;
position: relative;
top: 0;
left: 0;
z-index: 0;
margin: 0;
padding: 0;
width: 100%;
height: 200px;
max-height: 100vh;
font-size: 11px;
text-align: left;
}
.rptPositioner {
width: 33%;
display: block;
transform-origin: 0px 0px;
transform: scale(3, 3);
}
.rptHeader {
position: sticky !important;
top: 0 !important;
z-index: 1;
background: #eee;
}
body {
margin: 0;
padding: 0;
}
<div class="rptDisplay">
<div class="rptPositioner">
<div class="rptHeader">Header</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
<div class="row">Row</div>
</div>
</div>
The trouble is there is some very weird behaviour, when I scroll the header scrolls down the page at a different rate to the page scrolling down itself. Bare in mind that the transform scale is user changable for zooming, the sticky position was added recently.
I tracked the issue down to the scaling not being applied to the rptDisplay but being applied to a child of display but a parent of the sticky element. If I apply the scaling to the display or to the header the problem goes away, but that isnt currently an option.
I have attached a CodePen that demostrates the issue we are seeing.