Aktivierbare Komponenten: kein Auto-Setzen von Werten bei Schalter an

This commit is contained in:
2026-05-23 10:27:56 +02:00
parent 973e05dd73
commit 7abd6506e6
+14 -7
View File
@@ -676,9 +676,11 @@
return;
}
options.forEach((option, index) => {
option.setAttribute('aria-checked', String(isActive && index === 0));
});
if (!isActive) {
options.forEach((option) => {
option.setAttribute('aria-checked', 'false');
});
}
target.dataset.open = 'false';
trigger.setAttribute('aria-expanded', 'false');
updatePulldownSelectionState(target);
@@ -691,17 +693,22 @@
return;
}
checkbox.setAttribute('aria-checked', String(isActive));
checkbox.classList.toggle('sg-form-active', isActive);
if (!isActive) {
checkbox.setAttribute('aria-checked', 'false');
}
const isChecked = checkbox.getAttribute('aria-checked') === 'true';
checkbox.classList.toggle('sg-form-active', isChecked);
checkbox.classList.toggle('sg-checkbox-field--inactive-selectable', !isActive);
return;
}
if (componentType === 'radio-field') {
const radios = target.querySelectorAll('.sg-radio-field');
const defaultRadio = radios[0];
radios.forEach((radio) => {
const checked = isActive && radio === defaultRadio;
if (!isActive) {
radio.setAttribute('aria-checked', 'false');
}
const checked = radio.getAttribute('aria-checked') === 'true';
radio.setAttribute('aria-checked', String(checked));
radio.classList.toggle('sg-form-active', checked);
radio.classList.toggle('sg-radio-field--inactive-selectable', !isActive);