Skip to content

Commit d8ac272

Browse files
author
Caleb Kish
committed
use _getFocusedElementPierceShadowDom
1 parent b06aebd commit d8ac272

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/material/timepicker/timepicker-input.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {Subscription} from 'rxjs';
4242
import {DOWN_ARROW, ESCAPE, hasModifierKey, UP_ARROW} from '@angular/cdk/keycodes';
4343
import {validateAdapter} from './util';
4444
import {DOCUMENT} from '@angular/common';
45-
import {_getShadowRoot} from '../../cdk/platform';
45+
import {_getFocusedElementPierceShadowDom} from '../../cdk/platform';
4646

4747
/**
4848
* Input that can be used to enter time and connect to a `mat-timepicker`.
@@ -407,8 +407,7 @@ export class MatTimepickerInput<D> implements ControlValueAccessor, Validator, O
407407

408408
/** Whether the input is currently focused. */
409409
private _hasFocus(): boolean {
410-
const root = _getShadowRoot(this._elementRef.nativeElement) || this._document;
411-
return root.activeElement === this._elementRef.nativeElement;
410+
return _getFocusedElementPierceShadowDom() === this._elementRef.nativeElement;
412411
}
413412

414413
/** Gets a function that can be used to validate the input. */

0 commit comments

Comments
 (0)