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]); useHotkeys(
'esc',
const [showMediaAlt, setShowMediaAlt] = useState(false); onClose,
{
ignoreEventWhen: (e) => {
const hasModal = !!document.querySelector('#modal-container > *');
return hasModal;
},
},
[onClose],
);
useEffect(() => { useEffect(() => {
let handleScroll = () => { let handleScroll = () => {