Skip to content

Commit

Permalink
fix(material/chips): placeholder visible on focus
Browse files Browse the repository at this point in the history
prior this commit the placeholder was only visible if the chips get focused, this commit makes sure that if we have any sort of data we show our input's placeholder

fixes #26883
  • Loading branch information
naaajii committed Aug 13, 2023
1 parent 595b3da commit 069e111
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/material/chips/chip-grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const _MatChipGridMixinBase = mixinErrorState(MatChipGridBase);
'[class.mat-mdc-chip-list-disabled]': 'disabled',
'[class.mat-mdc-chip-list-invalid]': 'errorState',
'[class.mat-mdc-chip-list-required]': 'required',
'[class.mat-mdc-chip-list-placeholder]': '_chips && _chips.length',
'(focus)': 'focus()',
'(blur)': '_blur()',
},
Expand Down
10 changes: 10 additions & 0 deletions src/material/chips/chip-set.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ input.mat-mdc-chip-input {
margin-right: 8px;
}
}

// This ensures that if we have any sort of data in our chips, we apply
// a class & set placeholder to be visible so it doesn't show only when
// form field is focused.
.mat-mdc-chip-list-placeholder {
// stylelint-disable-next-line material/no-prefixes
.mat-mdc-chip-input::placeholder {
opacity: 1;
}
}

0 comments on commit 069e111

Please sign in to comment.