Skip to content

Commit

Permalink
[@mantine/core] Modal: Prevent onClose from being called when modal…
Browse files Browse the repository at this point in the history
… is not opened (#6156)
  • Loading branch information
hsskey authored May 2, 2024
1 parent a9e13ec commit 5ba2259
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function useModal({
useWindowEvent(
'keydown',
(event) => {
if (event.key === 'Escape' && closeOnEscape) {
if (event.key === 'Escape' && closeOnEscape && opened) {
const shouldTrigger =
(event.target as HTMLElement)?.getAttribute('data-mantine-stop-propagation') !== 'true';
shouldTrigger && onClose();
Expand Down

0 comments on commit 5ba2259

Please sign in to comment.