Skip to content

Commit

Permalink
refactor(focus-monitor): make checkChildren parameter optional (#9384)
Browse files Browse the repository at this point in the history
After we made the `renderer` param optional, `checkChildren` became required when using the two-param signature. These changes make it optional which is slightly more convenient on consumption.
  • Loading branch information
crisbeto authored and jelbourn committed Jan 29, 2018
1 parent 2f8bb8d commit 9c63f70
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cdk/a11y/focus-monitor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('FocusMonitor', () => {
focusMonitor = fm;

changeHandler = jasmine.createSpy('focus origin change handler');
focusMonitor.monitor(buttonElement, false).subscribe(changeHandler);
focusMonitor.monitor(buttonElement).subscribe(changeHandler);
patchElementFocus(buttonElement);
}));

Expand Down
4 changes: 2 additions & 2 deletions src/cdk/a11y/focus-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export class FocusMonitor {
* @returns An observable that emits when the focus state of the element changes.
* When the element is blurred, null will be emitted.
*/
monitor(element: HTMLElement, checkChildren: boolean): Observable<FocusOrigin>;
monitor(element: HTMLElement, checkChildren?: boolean): Observable<FocusOrigin>;
monitor(
element: HTMLElement,
renderer: Renderer2 | boolean,
renderer?: Renderer2 | boolean,
checkChildren?: boolean): Observable<FocusOrigin> {
// TODO(mmalerba): clean up after deprecated signature is removed.
if (!(renderer instanceof Renderer2)) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc

ngAfterViewInit() {
this._focusMonitor
.monitor(this._inputElement.nativeElement, false)
.monitor(this._inputElement.nativeElement)
.subscribe(focusOrigin => this._onInputFocusChange(focusOrigin));
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/expansion/expansion-panel-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class MatExpansionPanelHeader implements OnDestroy {
)
.subscribe(() => this._changeDetectorRef.markForCheck());

_focusMonitor.monitor(_element.nativeElement, false);
_focusMonitor.monitor(_element.nativeElement);
}

/** Height of the header while the panel is expanded. */
Expand Down
2 changes: 1 addition & 1 deletion src/lib/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ export class MatRadioButton extends _MatRadioButtonMixinBase

ngAfterViewInit() {
this._focusMonitor
.monitor(this._inputElement.nativeElement, false)
.monitor(this._inputElement.nativeElement)
.subscribe(focusOrigin => this._onInputFocusChange(focusOrigin));
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/slide-toggle/slide-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
this._slideRenderer = new SlideToggleRenderer(this._elementRef, this._platform);

this._focusMonitor
.monitor(this._inputElement.nativeElement, false)
.monitor(this._inputElement.nativeElement)
.subscribe(focusOrigin => this._onInputFocusChange(focusOrigin));
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class MatTooltip implements OnDestroy {
element.style.webkitUserSelect = element.style.userSelect = '';
}

_focusMonitor.monitor(element, false).subscribe(origin => {
_focusMonitor.monitor(element).subscribe(origin => {
// Note that the focus monitor runs outside the Angular zone.
if (!origin) {
_ngZone.run(() => this.hide(0));
Expand Down

0 comments on commit 9c63f70

Please # to comment.