Skip to content

Commit e3dba2c

Browse files
committed
fix(checkbox): observe mutations to childlist
1 parent cba086a commit e3dba2c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

core/src/components/checkbox/checkbox.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ export class Checkbox implements ComponentInterface {
154154
if (Build.isBrowser && typeof MutationObserver !== 'undefined') {
155155
this.validationObserver = new MutationObserver((mutations) => {
156156
// Watch for label content changes
157-
if (mutations.some((mutation) => mutation.type === 'characterData')) {
157+
if (mutations.some((mutation) => mutation.type === 'characterData' || mutation.type === 'childList')) {
158158
this.hasLabelContent = this.el.textContent !== '';
159159
}
160160
// Watch for class changes to update validation state.
161-
if (mutations.some((mutation) => mutation.type === 'attributes')) {
161+
if (mutations.some((mutation) => mutation.type === 'attributes' && mutation.target === el)) {
162162
const newIsInvalid = checkInvalidState(el);
163163
if (this.isInvalid !== newIsInvalid) {
164164
this.isInvalid = newIsInvalid;
@@ -191,6 +191,7 @@ export class Checkbox implements ComponentInterface {
191191
attributes: true,
192192
attributeFilter: ['class'],
193193
characterData: true,
194+
childList: true,
194195
subtree: true,
195196
});
196197
}

0 commit comments

Comments
 (0)