Skip to content

Commit 6d96332

Browse files
mleibmanmmalerba
authored andcommitted
Fix a bug in _getFocusOrigin().
1 parent 9e991ab commit 6d96332

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/cdk/a11y/focus-monitor/focus-monitor.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,17 @@ export class FocusMonitor implements OnDestroy {
326326
// 2) It was caused by a touch event, in which case we mark the origin as 'touch'.
327327
// 3) The element was programmatically focused, in which case we should mark the origin as
328328
// 'program'.
329-
let origin = this._origin;
330-
if (!origin) {
331-
if (this._windowFocused && this._lastFocusOrigin) {
332-
return this._lastFocusOrigin;
333-
} else if (this._wasCausedByTouch(event)) {
334-
return 'touch';
335-
} else {
336-
return 'program';
337-
}
329+
if (this._origin) {
330+
return this._origin;
331+
}
332+
333+
if (this._windowFocused && this._lastFocusOrigin) {
334+
return this._lastFocusOrigin;
335+
} else if (this._wasCausedByTouch(event)) {
336+
return 'touch';
337+
} else {
338+
return 'program';
338339
}
339-
return null;
340340
}
341341

342342
/**

0 commit comments

Comments
 (0)