Skip to content

Datepicker - When open, pressing Esc key should just close datepicker and stop event propagation #12344

@naveedahmed1

Description

@naveedahmed1

Bug, feature request, or proposal:

When a Datepicker is open, pressing Esc key closes it, which is fine. The issue arises when the parent component is also monitoring Esc key.

For example I have a form which contains the Datepicker component. I want the form to be closed when the user presses Esc key. But if the user has a Datepicker open, and presses Esc key, it closes the form, whereas it should only close the Datepicker.

What is the expected behavior?

Datepicker should stop propagation of the same event to the parent.

What are the steps to reproduce?

Visit https://stackblitz.com/edit/angular-b1wcka

Open datepicker and press Esc key to close datepicker, this will close the whole form instead of just closing the datepicker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/datepicker

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions