Fix bugs with Clarity boost select box

This commit is contained in:
redphx
2024-07-17 07:48:36 +07:00
parent 2db246e081
commit 742fd24b8c
4 changed files with 15 additions and 2 deletions

View File

@@ -82,6 +82,9 @@ export class BxSelectElement {
$label.textContent = content;
}
// Add line-through on disabled option
$label.classList.toggle('bx-line-through', $option && $option.disabled);
// Hide checkbox when the selection is empty
if (isMultiple) {
$checkBox.checked = $option?.selected || false;
@@ -123,13 +126,16 @@ export class BxSelectElement {
const observer = new MutationObserver((mutationList, observer) => {
mutationList.forEach(mutation => {
mutation.type === 'childList' && render();
if (mutation.type === 'childList' || mutation.type === 'attributes') {
render();
}
});
});
observer.observe($select, {
subtree: true,
childList: true,
attributes: true,
});
render();