vertical-collection icon indicating copy to clipboard operation
vertical-collection copied to clipboard

scrollLeft of the row inner element is not retained

Open azhiv opened this issue 6 years ago • 0 comments

I wrote a simple modifier which scrolls the element horizontally. scroll.js:

export default modifier(function scroll(element, params, { scrollLeft }) {
  if (scrollLeft !== undefined) {
    element.scrollLeft = scrollLeft;
  }
});

I use VC as follows:

<div class="vertical-collection-container">
  <VerticalCollection
    @items={{this.items}}
    @key="id"
    @estimateHeight={{50}}
    @staticHeight={{true}}
    @renderAll={{false}}
    as |item|
  >
    <div class="row-container">
      <div class="row-index">{{item.id}}.</div>
      <InnerComponent/>
    </div>
  </VerticalCollection>
</div>

inner-component.hbs:

<div class="inner-component-container" {{scroll scrollLeft=40}}>
  <div class="inner-component-long-div">123456789</div>
</div>

On initial render the page looks like this:

Screenshot 2019-11-15 at 13 53 16

which is exactly what it should. Then I scroll down a little bit:

Screenshot 2019-11-15 at 13 53 32

And newly rendered rows are not scrolled left. If I then scroll back up:

Screenshot 2019-11-15 at 14 06 08

the first items are no longer shifted left.

The issue disappears when using renderAll=true.

The sources of the app can be found here

azhiv avatar Nov 15 '19 11:11 azhiv