Skip to content

Commit

Permalink
fix: 모달 키보드 이벤트로 꺼지는 버그 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
yunchaehyun committed Dec 7, 2023
1 parent 0118da3 commit e86e4a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export default function Modal({ onClose, children }: ModalProps) {
onClick={onClose}
role="button"
tabIndex={0}
onKeyDown={onClose}
onKeyDown={preventBubbling}
>
<div
className={styles.container}
onClick={preventBubbling}
role="button"
tabIndex={0}
onKeyDown={onClose}
onKeyDown={preventBubbling}
>
<IconButton className={styles.close} onClick={onClose}>
<IoCloseOutline />
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/utils/event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const preventBubbling = (e: React.MouseEvent<Element>) => {
const preventBubbling = <T extends Element>(
e: React.MouseEvent<T> | React.KeyboardEvent<T>,
) => {
e.stopPropagation();
};

Expand Down

0 comments on commit e86e4a1

Please sign in to comment.