Fix activatable pulldown enabling behavior
This commit is contained in:
@@ -700,11 +700,20 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasSelectedOption = Array.from(options).some((option) => option.getAttribute('aria-checked') === 'true');
|
||||||
|
if (isActive && !hasSelectedOption) {
|
||||||
|
options[0].setAttribute('aria-checked', 'true');
|
||||||
|
}
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
options.forEach((option) => {
|
options.forEach((option) => {
|
||||||
option.setAttribute('aria-checked', 'false');
|
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';
|
target.dataset.open = 'false';
|
||||||
trigger.setAttribute('aria-expanded', 'false');
|
trigger.setAttribute('aria-expanded', 'false');
|
||||||
updatePulldownSelectionState(target);
|
updatePulldownSelectionState(target);
|
||||||
|
|||||||
Reference in New Issue
Block a user