Skip to content

Commit a7da9f4

Browse files
committed
fix overlay font size on safari
1 parent 05dffe8 commit a7da9f4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/lib/select/select.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
ViewportRuler,
2020
} from '@angular/cdk/overlay';
2121
import {Platform} from '@angular/cdk/platform';
22-
import {filter, startWith} from '@angular/cdk/rxjs';
22+
import {filter, first, startWith} from '@angular/cdk/rxjs';
2323
import {
2424
AfterContentInit,
2525
Attribute,
@@ -35,6 +35,7 @@ import {
3535
InjectionToken,
3636
Input,
3737
isDevMode,
38+
NgZone,
3839
OnDestroy,
3940
OnInit,
4041
Optional,
@@ -60,7 +61,7 @@ import {Observable} from 'rxjs/Observable';
6061
import {merge} from 'rxjs/observable/merge';
6162
import {Subject} from 'rxjs/Subject';
6263
import {Subscription} from 'rxjs/Subscription';
63-
import {fadeInContent, transformPanel, transformPlaceholder} from './select-animations';
64+
import {fadeInContent, transformPanel} from './select-animations';
6465
import {
6566
getMdSelectDynamicMultipleError,
6667
getMdSelectNonArrayValueError,
@@ -295,7 +296,6 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
295296
/**
296297
* Stream that emits whenever the state of the select changes such that the wrapping `MdFormField`
297298
* needs to run change detection.
298-
* TODO(mmalerba): Call emit at appropriate times.
299299
*/
300300
stateChanges = new Subject<void>();
301301

@@ -428,6 +428,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
428428
private _viewportRuler: ViewportRuler,
429429
private _changeDetectorRef: ChangeDetectorRef,
430430
private _platform: Platform,
431+
private _ngZone: NgZone,
431432
renderer: Renderer2,
432433
elementRef: ElementRef,
433434
@Optional() private _dir: Directionality,
@@ -487,6 +488,13 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
487488
this._calculateOverlayPosition();
488489
this._panelOpen = true;
489490
this._changeDetectorRef.markForCheck();
491+
492+
// Set the font size on the panel element once it exists.
493+
first.call(this._ngZone.onStable).subscribe(() => {
494+
if (this._triggerFontSize && this.overlayDir.overlayRef.overlayElement) {
495+
this.overlayDir.overlayRef.overlayElement.style.fontSize = `${this._triggerFontSize}px`;
496+
}
497+
});
490498
}
491499

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

0 commit comments

Comments
 (0)