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

[thumbAutosize]="true" causes random invalid starting thumbnail scroller position when scrolling possible #521

Closed
AngeloGi opened this issue Jan 21, 2023 · 6 comments · Fixed by #583
Labels

Comments

@AngeloGi
Copy link

AngeloGi commented Jan 21, 2023

What is the expected behavior?

The thumbnail scroller should be unscrolled, at its leftmost/topmost point.

What is the current behavior?

The thumbnail scroller scrolls past the selected (highlighted) image, stopping at some seemingly random point. Note, it does NOT happen in every refresh, it seems to happen randomly at each render, as you keep refreshing.

What are the steps to reproduce?

Add a gallery with the below parameters:

<gallery imageSize="contain" [thumbAutosize]="true" thumbPosition="right" [items]="images">
  </gallery>

Make sure that the thumbnails are enough so that they can scroll and do not fit all at once.

Refresh the page a few times, until you see the thumbnail scroller start randomly pre-scrolled, past the highlighted item.

What is the use-case or motivation for changing an existing behavior?

Which versions are you using for the following packages?

Angular: 15.1.1
Angular CDK: 15.1.1
Angular CLI: 15.1.2
Typescript: 4.9.4
Gallery: 8.0.2

Is there anything else we should know?

First page render (correct, expected scroll position at image 1)
first render (correct scroll position)
After refreshing a few times (scrolled past highlighted image 1)
After refreshing a few times (scrolled past highlighted item)

@AngeloGi AngeloGi changed the title [thumbAutosize]="true" causes invalid starting scroll position when not all thumbnails fit at once without scrolling [thumbAutosize]="true" causes random invalid starting thumbnail scroller position when scrolling possible Jan 21, 2023
@MurhafSousli
Copy link
Owner

MurhafSousli commented Jan 22, 2023

Could you add a stackblitz reproduction https://stackblitz.com/edit/ngx-gallery?

Try setting loadingAttr="eager" and see if that fixes the issue!

@AngeloGi
Copy link
Author

AngeloGi commented Feb 3, 2023

I tried but that attribute is not making any difference!

I also tried replicating my code into stackblitz but it's not happening. I am assuming it has something to do with the loading differences (my API vs the stock images)...I don't know how else I can debug this! It seems while the images load, they push each other around and that causes scrolling on the thumbnail container.

@MurhafSousli
Copy link
Owner

Hmmm, so maybe in this case it should trigger an update every time an image is loaded

@peterviegas
Copy link

How to eliminate the item that appears black at the beginning and end of the carousel?

@MurhafSousli
Copy link
Owner

@peterviegas what item appears black? if you mean the empty spaces in the main slider you can use imageSize="cover", I would recommend opening a new issue with a reproduction

@peterviegas
Copy link

peterviegas commented Aug 9, 2023 via email

@MurhafSousli MurhafSousli linked a pull request Dec 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants