Skip to content

MatAutocomplete panel does not close when the parent input changes focus programmatically. #28087

Open
@andybougard

Description

@andybougard

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When adding host listener for keyboard navigation to other elements, the auto complete panel does not close.

Reproduction

StackBlitz link: https://stackblitz.com/edit/angular-14-material-fbxecy?file=src%2Fauto-complete%2Fauto-complete.component.html
Steps to reproduce:

  1. Click in the "Number" input.
  2. Press Ctrl+DownArrow.
  3. Observe that focus moves to the text area input without closing the panel.

Expected Behavior

After the focus of the parent input moves to another element (either by click() or blur()), the panel should be closed.

Actual Behavior

After moving focus from the parent input by using element.focus() the auto complete panel keeps visible until a click action takes place.

Environment

  • Angular: 14
  • CDK/Material:
  • Browser(s): Edge
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/autocompleteneeds: clarificationThe issue does not contain enough information for the team to determine if it is a real bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions