Skip to content

Commit e012f08

Browse files
committed
fix overlay font size on safari
1 parent 95e35b1 commit e012f08

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/lib/select/select.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
Inject,
2121
InjectionToken,
2222
Input,
23+
NgZone,
2324
OnDestroy,
2425
OnInit,
2526
Optional,
@@ -35,7 +36,7 @@ import {DOWN_ARROW, END, ENTER, HOME, SPACE, UP_ARROW} from '@angular/cdk/keycod
3536
import {FocusKeyManager} from '@angular/cdk/a11y';
3637
import {Directionality} from '@angular/cdk/bidi';
3738
import {coerceBooleanProperty} from '@angular/cdk/coercion';
38-
import {filter, startWith} from '@angular/cdk/rxjs';
39+
import {filter, first, startWith} from '@angular/cdk/rxjs';
3940
import {
4041
ConnectedOverlayDirective,
4142
Overlay,
@@ -281,7 +282,6 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
281282
/**
282283
* Stream that emits whenever the state of the select changes such that the wrapping `MdFormField`
283284
* needs to run change detection.
284-
* TODO(mmalerba): Call emit at appropriate times.
285285
*/
286286
stateChanges = new Subject<void>();
287287

@@ -405,6 +405,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
405405
private _viewportRuler: ViewportRuler,
406406
private _changeDetectorRef: ChangeDetectorRef,
407407
private _platform: Platform,
408+
private _ngZone: NgZone,
408409
renderer: Renderer2,
409410
elementRef: ElementRef,
410411
@Optional() private _dir: Directionality,
@@ -475,6 +476,13 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
475476
this._calculateOverlayPosition();
476477
this._panelOpen = true;
477478
this._changeDetectorRef.markForCheck();
479+
480+
// Set the font size on the panel element once it exists.
481+
first.call(this._ngZone.onStable).subscribe(() => {
482+
if (this._triggerFontSize && this.overlayDir.overlayRef.overlayElement) {
483+
this.overlayDir.overlayRef.overlayElement.style.fontSize = `${this._triggerFontSize}px`;
484+
}
485+
});
478486
}
479487

480488
/** Closes the overlay panel and focuses the host element. */

0 commit comments

Comments
 (0)