Skip to content

Commit a5c8d57

Browse files
volvachevEgor Volvachev
authored andcommitted
fix(material/chips): selectable="false" doesn't work on initial assignment
Fixes #24903.
1 parent 567be4f commit a5c8d57

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/material/chips/chip-list.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,7 @@ export class MatChipList
329329
}
330330
set selectable(value: BooleanInput) {
331331
this._selectable = coerceBooleanProperty(value);
332-
333-
if (this.chips) {
334-
this.chips.forEach(chip => (chip.chipListSelectable = this._selectable));
335-
}
332+
this._syncChipsState();
336333
}
337334
protected _selectable: boolean = true;
338335

@@ -414,7 +411,7 @@ export class MatChipList
414411

415412
// When the list changes, re-subscribe
416413
this.chips.changes.pipe(startWith(null), takeUntil(this._destroyed)).subscribe(() => {
417-
if (this.disabled) {
414+
if (this.disabled || !this.selectable) {
418415
// Since this happens after the content has been
419416
// checked, we need to defer it to the next tick.
420417
Promise.resolve().then(() => {
@@ -844,6 +841,7 @@ export class MatChipList
844841
this.chips.forEach(chip => {
845842
chip._chipListDisabled = this._disabled;
846843
chip._chipListMultiple = this.multiple;
844+
chip.chipListSelectable = this._selectable;
847845
});
848846
}
849847
}

0 commit comments

Comments
 (0)