mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-29 07:34:07 +00:00
fix: restrict keyboard event handling to modal elements only (#6408)
* fix: restrict keyboard event handling to modal elements only * chore: minor refactor --------- Co-authored-by: Bijin A B <bijin@usebruno.com>
This commit is contained in:
@@ -82,6 +82,12 @@ const Modal = ({
|
||||
|
||||
const handleKeydown = (event) => {
|
||||
const { keyCode, shiftKey, ctrlKey, altKey, metaKey } = event;
|
||||
|
||||
// Only handle events from elements inside this modal
|
||||
if (keyCode !== ESC_KEY_CODE && (!modalRef.current || !modalRef.current.contains(event.target))) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (keyCode) {
|
||||
case ESC_KEY_CODE: {
|
||||
if (disableEscapeKey) return;
|
||||
|
||||
Reference in New Issue
Block a user