From 7abd6506e6b1c2a60b16e5887d20df4f0f522c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Gla=CC=88ser?= Date: Sat, 23 May 2026 10:27:56 +0200 Subject: [PATCH] Aktivierbare Komponenten: kein Auto-Setzen von Werten bei Schalter an --- components/interactive-elements.html | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/components/interactive-elements.html b/components/interactive-elements.html index 2155b36..74587a9 100644 --- a/components/interactive-elements.html +++ b/components/interactive-elements.html @@ -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);