Skip to content

[Bug] Default handling for "renderError.ufModal" #1231

@avsdev-cw

Description

@avsdev-cw

Submitted by request from UF chat.

Applies to both UF4 and UF5.

If a modal causes an error (e.g. permission denied) then trying to repeat the action, or attempt to do any other action which would trigger a modal, without reloading the page does not do anything. This is because the "renderError.ufModal" event is never listened to and ufModal.destroy() is never called.

I managed to add a recursive global listener (required because the ufModal.destroy() method removes all listeners) by doing something like:

$(document).ready(function() {
    const handleModalError = function() {
        $(this).ufModal('destroy');
        $('body').on('renderError.ufModal', handleModalError);
    }
    $('body').on('renderError.ufModal', handleModalError);
});

however it causes a javscript exception (uf-modal.js:146):

Uncaught TypeError: instance is undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    References

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions