Disable inactive radios in multiselect pulldown

This commit is contained in:
2026-05-27 10:52:32 +02:00
parent aaf2310379
commit 422fcad1a9
+9
View File
@@ -328,6 +328,7 @@
const radios = radioGroup.querySelectorAll('.sg-radio-field'); const radios = radioGroup.querySelectorAll('.sg-radio-field');
radioGroup.dataset.componentState = isActive ? 'active' : 'inactive-selectable'; radioGroup.dataset.componentState = isActive ? 'active' : 'inactive-selectable';
radios.forEach((radio) => { radios.forEach((radio) => {
radio.disabled = !isActive;
if (!isActive) { if (!isActive) {
radio.setAttribute('aria-checked', 'false'); radio.setAttribute('aria-checked', 'false');
} }
@@ -485,12 +486,20 @@
const radios = activatableGroup.querySelectorAll('.sg-radio-field'); const radios = activatableGroup.querySelectorAll('.sg-radio-field');
radios.forEach((otherRadio) => { radios.forEach((otherRadio) => {
otherRadio.setAttribute('aria-checked', String(otherRadio === radio)); otherRadio.setAttribute('aria-checked', String(otherRadio === radio));
otherRadio.disabled = false;
otherRadio.classList.remove('sg-radio-field--inactive-selectable'); otherRadio.classList.remove('sg-radio-field--inactive-selectable');
otherRadio.classList.toggle('sg-form-active', otherRadio === radio); otherRadio.classList.toggle('sg-form-active', otherRadio === radio);
}); });
}); });
}); });
document.querySelectorAll('[data-activatable-radio-group="true"]').forEach((group) => {
const isActive = group.dataset.componentState === 'active';
group.querySelectorAll('.sg-radio-field').forEach((radio) => {
radio.disabled = !isActive;
});
});
updateMultiselectLabelAlignment(); updateMultiselectLabelAlignment();
window.addEventListener('resize', updateMultiselectLabelAlignment); window.addEventListener('resize', updateMultiselectLabelAlignment);