Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions assets/variant-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ export default class VariantPicker extends Component {
this.#radios.push(radios);

const initialCheckedIndex = radios.findIndex((radio) => radio.dataset.currentChecked === 'true');
if (initialCheckedIndex !== -1) {
this.#checkedIndices.push([initialCheckedIndex]);
}

// TARGETED FIX: Always push an array to match the index of fieldsets.
// This ensures 'checkedIndices' is not undefined in updateSelectedOption
// when a user selects an option in a previously unchecked fieldset.
this.#checkedIndices.push(initialCheckedIndex !== -1 ? [initialCheckedIndex] : []);
});

this.addEventListener('change', this.variantChanged.bind(this));
Expand Down