Skip to content

Commit

Permalink
fix(material/autocomplete): not closing when clicking on hint area (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
crisbeto authored Dec 22, 2023
1 parent 94d8997 commit 6b7e6c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/material/autocomplete/autocomplete-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ export class MatAutocompleteTrigger
// If we're in the Shadow DOM, the event target will be the shadow root, so we have to
// fall back to check the first element in the path of the click event.
const clickTarget = _getEventTarget<HTMLElement>(event)!;
const formField = this._formField ? this._formField._elementRef.nativeElement : null;
const formField = this._formField
? this._formField.getConnectedOverlayOrigin().nativeElement
: null;
const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;

return (
Expand Down

0 comments on commit 6b7e6c5

Please sign in to comment.