Skip to content

Commit 6b7e6c5

Browse files
authored
fix(material/autocomplete): not closing when clicking on hint area (#28316)
Fixes that the autocomplete was ignoring clicks on the entire form field area, including hints, rather than just the form field inner container. Fixes #28271.
1 parent 94d8997 commit 6b7e6c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/material/autocomplete/autocomplete-trigger.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ export class MatAutocompleteTrigger
407407
// If we're in the Shadow DOM, the event target will be the shadow root, so we have to
408408
// fall back to check the first element in the path of the click event.
409409
const clickTarget = _getEventTarget<HTMLElement>(event)!;
410-
const formField = this._formField ? this._formField._elementRef.nativeElement : null;
410+
const formField = this._formField
411+
? this._formField.getConnectedOverlayOrigin().nativeElement
412+
: null;
411413
const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;
412414

413415
return (

0 commit comments

Comments
 (0)