You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why do Modals (and Dropdowns) use keyDown while Overlays use keyUp? Is there a principle or is this just happenstance?
Motivation is that if you're building a UI element that responds to the escape key, you'll need to stopPropagation of both events in order to make it safe to use inside both modals and other types of overlays. Devs on my team have rediscovered this a couple of times now.
Describe the bug
Why do Modals (and Dropdowns) use keyDown while Overlays use keyUp? Is there a principle or is this just happenstance?
Motivation is that if you're building a UI element that responds to the escape key, you'll need to stopPropagation of both events in order to make it safe to use inside both modals and other types of overlays. Devs on my team have rediscovered this a couple of times now.
To Reproduce
Overlays
Modals
Expected behavior
Presumably they should both trigger off the same event. Or maybe they shouldn't!
If so, probably
keyDown
since bootstrap unambiguously uses that for modals & dropdowns.Even better would be to make it configurable, but implementation of that doesn't seem straightforward.
Environment (please complete the following information)
Additional context
Overlay:
ui/src/useRootClose.ts
Line 39 in 44dc346
Modal:
ui/src/Modal.tsx
Lines 399 to 407 in 44dc346
Bootstrap Modal:
https://github.com/react-bootstrap/react-bootstrap/blob/a58a0cd6e548c653cda23ed529f3cff69ec123cc/src/Modal.tsx#L382
The text was updated successfully, but these errors were encountered: