diff --git a/components/interactive-elements.html b/components/interactive-elements.html index 5263192..c7320c4 100644 --- a/components/interactive-elements.html +++ b/components/interactive-elements.html @@ -700,11 +700,20 @@ return; } + const hasSelectedOption = Array.from(options).some((option) => option.getAttribute('aria-checked') === 'true'); + if (isActive && !hasSelectedOption) { + options[0].setAttribute('aria-checked', 'true'); + } if (!isActive) { options.forEach((option) => { option.setAttribute('aria-checked', 'false'); }); } + + options.forEach((option) => { + option.classList.toggle('sg-checkbox-field--inactive-selectable', !isActive); + option.classList.toggle('sg-form-active', option.getAttribute('aria-checked') === 'true'); + }); target.dataset.open = 'false'; trigger.setAttribute('aria-expanded', 'false'); updatePulldownSelectionState(target);