Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 08f736a

Browse files
authored
fix(select): Should float asterisk if no placeholder (#1784)
reference: #1766
1 parent 457e337 commit 08f736a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

demos/src/app/components/select-demo/examples.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ <h3 class="demo-content__headline">Custom Enhanced</h3>
143143
<div class="demo-content">
144144
<h3 class="demo-content__headline">Lazy Load</h3>
145145
<form [formGroup]="lazyLoadForm" #formDirectiveLazy="ngForm">
146-
<mdc-select outlined formControlName="lazySelect" [helperText]="lazyHelper">
146+
<mdc-select outlined formControlName="lazySelect" [helperText]="lazyHelper" class="demo-enhanced-width">
147147
<option *ngFor="let food of lazyFoods" [value]="food.value" [disabled]="food.disabled">{{food.viewValue}}</option>
148148
</mdc-select>
149149
<mdc-helper-text #lazyHelper validation>
@@ -245,4 +245,4 @@ <h3 class="demo-content__headline">Select with FormControl</h3>
245245
<p>Value: {{ foodForm.value | json }}</p>
246246

247247
<example-viewer [example]="exampleReactive"></example-viewer>
248-
</div>
248+
</div>

packages/select/select.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,8 @@ export class MdcSelect extends _MdcSelectMixinBase implements AfterViewInit, DoC
693693
}
694694

695695
private _hasFloatingLabel(): boolean {
696-
return this.placeholder && this.floatLabel && (this._floatingLabel || this._notchedOutline) ? true : false;
696+
return (this.placeholder && this.floatLabel) || this._required
697+
&& (this._floatingLabel || this._notchedOutline) ? true : false;
697698
}
698699

699700
private _getFloatingLabel(): MdcFloatingLabel {

0 commit comments

Comments
 (0)