Skip to content

Commit

Permalink
485: When Modal onClickOutside=false Esc key causes failure (#488)
Browse files Browse the repository at this point in the history
Fix for issue #485 

When Modal onClickOutside=false, pressing the Esc key will cause the
modal to be hidden when the expected behavior is that an Esc key press
would do nothing.

Tests pass and no known issues have arisen.
  • Loading branch information
aVileBroker authored Nov 2, 2023
2 parents 5a2ef99 + e442c88 commit 429733f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const Modal = forwardRef<ModalApi, ModalProps>(

const escFunction = useCallback(
(event: KeyboardEvent) => {
if (event.code === 'Escape') {
if (event.code === 'Escape' && onClickOutside) {
animateClose(handleEsc, event);
}
},
Expand Down

0 comments on commit 429733f

Please sign in to comment.