Fix multiselect pulldown control start alignment by panel label width

This commit is contained in:
2026-05-25 08:52:09 +02:00
parent 2792104f45
commit 730cc137bb
2 changed files with 28 additions and 3 deletions
+21
View File
@@ -389,6 +389,24 @@
);
};
const updateMultiselectLabelAlignment = () => {
document.querySelectorAll('.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-panel').forEach((panel) => {
const labels = panel.querySelectorAll(
'.sg-slider-row[data-activatable="true"] > .sg-label, .sg-radio-activatable-group > .sg-label, [data-pulldown-filter-row] > .sg-pulldown-panel__label'
);
let maxWidth = 0;
labels.forEach((label) => {
const width = Math.ceil(label.getBoundingClientRect().width);
if (width > maxWidth) {
maxWidth = width;
}
});
panel.style.setProperty('--sg-multiselect-label-column-width', `${maxWidth}px`);
});
};
document.querySelectorAll('.sg-slider-row').forEach((row) => {
const slider = row.querySelector('.sg-slider');
const valueOutput = row.querySelector('.sg-slider-value');
@@ -469,6 +487,9 @@
});
});
updateMultiselectLabelAlignment();
window.addEventListener('resize', updateMultiselectLabelAlignment);
document.querySelectorAll('.sg-pulldown-demo').forEach((demo) => {
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');