Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/material-experimental/mdc-chips/chip-grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ export class MatChipGrid
this._chips.forEach(chip => chip.primaryAction._updateTabindex(-1));
this._chips.first.focus();
} else {
this._focusInput();
// Delay until the next tick, because this can cause a "changed after checked"
// error if the input does something on focus (e.g. opens an autocomplete).
Promise.resolve().then(() => this._chipInput.focus());
}

this.stateChanges.next();
Expand Down Expand Up @@ -482,9 +484,4 @@ export class MatChipGrid

this._lastDestroyedChipIndex = null;
}

/** Focus input element. */
private _focusInput() {
this._chipInput.focus();
}
}