Skip to content

Commit 0a20257

Browse files
committed
fix(material/autocomplete): prevent outside clicks from going to other overlays
Adds a subscription to the outside click stream of the autocomplete overlay so that the events don't propagate to other overlays which may close the autocomplete prematurely. Fixes #25238.
1 parent a26b192 commit 0a20257

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/material/autocomplete/autocomplete-trigger.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,11 @@ export abstract class _MatAutocompleteTriggerBase
836836
event.preventDefault();
837837
}
838838
});
839+
840+
// Subscribe to the pointer events stream so that it doesn't get picked up by other overlays.
841+
// TODO(crisbeto): we should switch `_getOutsideClickStream` eventually to use this stream,
842+
// but the behvior isn't exactly the same and it ends up breaking some internal tests.
843+
overlayRef.outsidePointerEvents().subscribe();
839844
}
840845
}
841846

0 commit comments

Comments
 (0)