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

Fix carousel duplicate thumbnail bug #15141

Merged
merged 2 commits into from May 9, 2018

Conversation

cathyxz
Copy link
Contributor

@cathyxz cathyxz commented May 7, 2018

Fixes a bug where lightbox manager processes carousels by adding lightbox group ids to the carousel. However, we rescan lightboxes on DOM update, so carousel contents are scanned twice, resulting in duplicate thumbnails.

Part of QA-ing lightbox with AliExpress.
Closes #15139.

@@ -188,6 +188,10 @@ export class LightboxManager {
&& slide.getAttribute('lightbox') !== lightboxGroupId);
if (!shouldExcludeSlide) {
slide.setAttribute('lightbox', lightboxGroupId);
if (this.seen_.includes(slide)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still need to set the attribute if the slide is in this.seen_? Or will it already be set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. Yes, it will have already been set if it's in seen.

@cathyxz cathyxz merged commit 7e49996 into ampproject:master May 9, 2018
@cathyxz cathyxz deleted the feature/ali-express-lightbox branch May 9, 2018 01:46
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request May 10, 2018
* Fix carousel duplicate thumbnail bug

* Reorder set lightbox and check if seen
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 this pull request may close these issues.

None yet

4 participants