Skip to content

Commit c881474

Browse files
kor-kjelbourn
authored andcommitted
refactor(mdc-chips): Base isEmptyInput check on chipInput value. (#16977)
Ensures that grids using custom input elements don't break on _isEmptyInput checks. (empty() in chip-input.ts uses the same !input.value logic, so there's no change for existing implementations.)
1 parent dadb3e1 commit c881474

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/material-experimental/mdc-chips/chip-grid.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,8 @@ export class MatChipGrid extends _MatChipGridMixinBase implements AfterContentIn
514514

515515
/** Returns true if element is an input with no value. */
516516
private _isEmptyInput(element: HTMLElement): boolean {
517-
if (element && element.nodeName.toLowerCase() === 'input') {
518-
let input = element as HTMLInputElement;
519-
return !input.value;
517+
if (element && element.id === this._chipInput!.id) {
518+
return this._chipInput.empty;
520519
}
521520

522521
return false;

0 commit comments

Comments
 (0)