Skip to content

Commit 2852c3f

Browse files
committed
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. (cherry picked from commit 6b7e6c5)
1 parent 543351f commit 2852c3f

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
@@ -406,7 +406,9 @@ export class MatAutocompleteTrigger
406406
// If we're in the Shadow DOM, the event target will be the shadow root, so we have to
407407
// fall back to check the first element in the path of the click event.
408408
const clickTarget = _getEventTarget<HTMLElement>(event)!;
409-
const formField = this._formField ? this._formField._elementRef.nativeElement : null;
409+
const formField = this._formField
410+
? this._formField.getConnectedOverlayOrigin().nativeElement
411+
: null;
410412
const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;
411413

412414
return (

0 commit comments

Comments
 (0)