Restore File throws a showModal() Error in Safari Browser

When attempting to restore a backup from a file under Settings >> Backup and Restore, the "Restore File..." button fails silently without showing the dialog and throws an error: dialogConfirmRestore.showModal' is undefined. This is happening for me in Safari 15.3 on MacOS, however it is working in Chrome.

image
image

Under further inspection, it appears the confirmRestore() function doesn't fall back to using a polyfill and I can fix this in the dev console by using registerDialog().

Here's the working example:

function confirmRestore(callback) {
    const dialogConfirmRestore = document.querySelector('#dialogConfirmRestore');

    // added polyfill fallback 
    if (!dialogConfirmRestore.showModal) {
        dialogPolyfill.registerDialog(dialogConfirmRestore);
    }
    dialogConfirmRestore.showModal();
    $('#btnCancelRestore').focus();
    $('#btnDoRestore').off("click");
    $('#btnDoRestore').on("click", function() {
        closeDialogConfirmRestore();
        callback();
    });
}
2 Likes

Noted and good catch!

2 Likes