Skip to content

Bug Report: Variant Selection Forces Media Reordering Instead of Index Navigation #3917

Description

@salvymc

Describe the current behavior

When a product variant is selected, the theme's JavaScript physically moves the associated variant image to the first position in the DOM (prepend/reorder) within the media-gallery component. Instead of simply scrolling to the correct index or updating the active slide, the entire gallery array is mutated.

This behavior breaks the visual logic of the product gallery.
If a merchant has carefully curated a specific sequence of images (e.g., Color A → Color B → Color C), selecting a variant in the middle of the sequence destroys that order.

Example Scenario:
Original Sequence: [Nero 1, Nero 2, Rosso 1, Rosso 2, Blu 1, Blu 2]
User Action: Selects variant "Blu".
Current Buggy Behavior: The system moves "Blu 1" to position 0.
Resulting Sequence: [Blu 1, Nero 1, Nero 2, Rosso 1, Rosso 2, Blu 2]

Outcome: The user sees the main image of the Blue variant, but the immediate "secondary" thumbnails are now Black or Red, creating a confusing and fragmented browsing experience.

Describe the expected behavior

The active thumbnail state should update to reflect the current view without forcing a layout shift or re-rendering the entire media list container.

Version information (Dawn, browsers and operating systems)

  • Dawn Version: 15.4.1
  • Chrome Version 147.0.7727.138
  • macOS Version 14.8.3 (23J220)

Additional context/screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions