Merge pull request #584 from silentrald/bugfix/modal-options-undefined

[bugfix] handle undefined modal options properly
This commit is contained in:
MathieuG-P
2024-09-21 21:07:24 +02:00
committed by GitHub
@@ -17,7 +17,7 @@ export function Modal() {
useEffect(() => {
const onEscape = (e: KeyboardEvent) => {
if (currentModal.options.closable === false || e.key !== "Escape") {
if (currentModal.options?.closable === false || e.key !== "Escape") {
return;
}
currentModal.resolver({ exitCode: ModalExitCode.CLOSED });
@@ -65,7 +65,7 @@ export function Modal() {
}
const onOverlayClicked = () => {
if (currentModal.options.closable === false) {
if (currentModal.options?.closable === false) {
return;
}