Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/cdk/a11y/focus-trap/event-listener-inert-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export class EventListenerFocusTrapInertStrategy implements FocusTrapInertStrate

// Don't refocus if target was in an overlay, because the overlay might be associated
// with an element inside the FocusTrap, ex. mat-select.
if (target && !focusTrapRoot.contains(target) &&
target.closest('div.cdk-overlay-pane') === null) {
if (target && !focusTrapRoot.contains(target) && !target.closest?.('div.cdk-overlay-pane')) {
// Some legacy FocusTrap usages have logic that focuses some element on the page
// just before FocusTrap is destroyed. For backwards compatibility, wait
// to be sure FocusTrap is still enabled before refocusing.
Expand Down