Skip to content

[DismissableLayer] since Escape key is handled on document level it breaks if parent element also listens for Esc #2653

@misha-erm

Description

@misha-erm

Hello,

Recently I've found out that Escape key is handled seprately for components like DropdownMenu and event handler for it is attached to document instead of a Content element.

Imagine a scenario where DropdownMenu is rendered inside a Parent component which also listens to escape and closes itself. How would I properly stop event propagation and close only DropdownMenu since doing something like <DropdownMenu.Content onKeyDown={(e)=>e.stopPropagation()} breaks it completely ?

Thanks in advance for any tips

Originally posted by @MikeYermolayev in #2644

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions