Skip to content
This repository was archived by the owner on Jun 5, 2023. It is now read-only.
This repository was archived by the owner on Jun 5, 2023. It is now read-only.

Modal: Don't close on Escape keypress when it's handled by nested UI components #166

@diondiondion

Description

@diondiondion

We need to add a way for UI components to prevent their own Escape key functionality from conflicting with that of the Modal component. Currently, pressing the Escape key to close e.g. a Select menu that lives within a modal will also close the modal, which is unexpected and frustrating to users.

The easiest way to achieve this would probably be to change global useEventListener hooks to regular onKeyDown props on wrapper components, so that the events can be stopped from propagating once they've been handled. Or maybe we just need to declare a more specific targetElement for the useEventListener hooks so they're not global and can be cancelled.

Separate handling may be needed for our generic Popover/Tooltip escape key listener, as it can't rely on a single wrapper element and needs to be global.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions