Also fix esc handling media alt modal in media modal

This commit is contained in:
Lim Chee Aun 2023-10-26 02:48:36 +08:00
parent 81644e67bb
commit 8426a011b0

View file

@ -66,9 +66,17 @@ function MediaModal({
};
}, []);
useHotkeys('esc', onClose, [onClose]);
const [showMediaAlt, setShowMediaAlt] = useState(false);
useHotkeys(
'esc',
onClose,
{
ignoreEventWhen: (e) => {
const hasModal = !!document.querySelector('#modal-container > *');
return hasModal;
},
},
[onClose],
);
useEffect(() => {
let handleScroll = () => {