Skip to content

Commit 3de57fb

Browse files
amcdnlandrewseguin
authored andcommitted
bug(chips): fixes placeholder in chip inputs #7481 (#7509)
* bug(chips): fixes placeholder in chip inputs #7481 * chore(nit): pr feedback * chore(tests): fix invalid test * chore(test): remove 'f'
1 parent 160a511 commit 3de57fb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/lib/chips/chip-list.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ describe('MatChipList', () => {
366366

367367
});
368368

369-
it('should not float placeholder if no chip is selected', () => {
369+
it('should float placeholder if chip is selected', () => {
370370
expect(formField.classList.contains('mat-form-field-should-float'))
371-
.toBe(false, 'placeholder should not be floating');
371+
.toBe(true, 'placeholder should be floating');
372372
});
373373

374374
it('should remove selection if chip has been removed', async(() => {

src/lib/chips/chip-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export class MatChipList implements MatFormFieldControl<any>, ControlValueAccess
244244
}
245245

246246
get shouldPlaceholderFloat(): boolean {
247-
return this.empty;
247+
return !this.empty || this.focused;
248248
}
249249

250250
/** Whether this chip-list is disabled. */

0 commit comments

Comments
 (0)