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

Variant image switching #191

Closed
ludoboludo opened this issue Jul 15, 2021 · 0 comments · Fixed by #158
Closed

Variant image switching #191

ludoboludo opened this issue Jul 15, 2021 · 0 comments · Fixed by #158
Labels
Category: Bug Something isn't working

Comments

@ludoboludo
Copy link
Contributor

Describe the current behavior

When changing the variant on the product page, it updates the image (if the variant has an image associated to it) and prepends it to the <ul>.

The checks being done in updateMedia() in the variant.js file doesn't check if the current media that is first in the list is already that same media. So for example, I was trying to add something to scroll back up to the top of the list when the media changes. The problem is that it gets triggered even when the image is actually not changing.

Describe the expected behavior

I think updateMedia() should only run if the media changes. If the media for White 32 is the same for White 36 we should run the function.

Version information (Dawn, browsers and operating systems)

  • Dawn Version: 1.1.0
  • Chrome Version 91.0.4472.114
  • macOS Version 11.3.1

Possible solution

Compare this.currentVariant?.featured_media with the first item in the parent's first element.

Additional context/screenshots
Video

@ludoboludo ludoboludo added the Category: Bug Something isn't working label Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant