Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrollLeft of the row inner element is not retained #305

Open
azhiv opened this issue Nov 15, 2019 · 0 comments
Open

scrollLeft of the row inner element is not retained #305

azhiv opened this issue Nov 15, 2019 · 0 comments

Comments

@azhiv
Copy link

azhiv commented Nov 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant