Skip to content

Commit

Permalink
fix overlay font size on safari
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Aug 15, 2017
1 parent 95e35b1 commit e012f08
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Inject,
InjectionToken,
Input,
NgZone,
OnDestroy,
OnInit,
Optional,
Expand All @@ -35,7 +36,7 @@ import {DOWN_ARROW, END, ENTER, HOME, SPACE, UP_ARROW} from '@angular/cdk/keycod
import {FocusKeyManager} from '@angular/cdk/a11y';
import {Directionality} from '@angular/cdk/bidi';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
import {filter, startWith} from '@angular/cdk/rxjs';
import {filter, first, startWith} from '@angular/cdk/rxjs';
import {
ConnectedOverlayDirective,
Overlay,
Expand Down Expand Up @@ -281,7 +282,6 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
/**
* Stream that emits whenever the state of the select changes such that the wrapping `MdFormField`
* needs to run change detection.
* TODO(mmalerba): Call emit at appropriate times.
*/
stateChanges = new Subject<void>();

Expand Down Expand Up @@ -405,6 +405,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
private _viewportRuler: ViewportRuler,
private _changeDetectorRef: ChangeDetectorRef,
private _platform: Platform,
private _ngZone: NgZone,
renderer: Renderer2,
elementRef: ElementRef,
@Optional() private _dir: Directionality,
Expand Down Expand Up @@ -475,6 +476,13 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
this._calculateOverlayPosition();
this._panelOpen = true;
this._changeDetectorRef.markForCheck();

// Set the font size on the panel element once it exists.
first.call(this._ngZone.onStable).subscribe(() => {
if (this._triggerFontSize && this.overlayDir.overlayRef.overlayElement) {
this.overlayDir.overlayRef.overlayElement.style.fontSize = `${this._triggerFontSize}px`;
}
});
}

/** Closes the overlay panel and focuses the host element. */
Expand Down

0 comments on commit e012f08

Please sign in to comment.