Fix activatable pulldown state sync timing

This commit is contained in:
2026-05-25 07:40:17 +02:00
parent 6a844f565c
commit 11a9f3c6f3
+8 -9
View File
@@ -780,15 +780,6 @@
});
});
// Sync activatable targets to the toggle's initial state on load.
document.querySelectorAll('.sg-activation-mode-toggle[data-activation-target]').forEach((toggle) => {
const target = document.getElementById(toggle.dataset.activationTarget);
if (!target) {
return;
}
setActivatableComponentState(target, toggle.dataset.active === 'relative');
});
document.querySelectorAll('.sg-tab-button-group').forEach((group) => {
group.querySelectorAll('.sg-tab-button').forEach((button) => {
button.addEventListener('click', () => {
@@ -975,6 +966,14 @@
};
document.querySelectorAll('.sg-pulldown-demo').forEach(updatePulldownSelectionState);
// Sync activatable targets to the toggle's initial state on load.
document.querySelectorAll('.sg-activation-mode-toggle[data-activation-target]').forEach((toggle) => {
const target = document.getElementById(toggle.dataset.activationTarget);
if (!target) {
return;
}
setActivatableComponentState(target, toggle.dataset.active === 'relative');
});
// Pulldown behavior: pulldown demos open their panel below the trigger.
// Opening one closes all sandwich menus and any other open pulldown demo.