Server: Can not listen to "X" close button on `OC.dialogs.confirmDestructive`

Created on 29 Jun 2020  路  4Comments  路  Source: nextcloud/server

From https://github.com/nextcloud/spreed/pull/3591#pullrequestreview-439053284

When the dialog to leave or join is shown clicking on the close button in the top right closes the dialog without selecting any option, which leaves the UI in a weird state. Unfortunately the close button is shown by default in the dialogs and there is no parameter to disable it in OC.dialogs, so this needs to be fixed in the server.

The OC.dialogs.confirmDestructive dialog has a non-removable close button which can not be listened to.
In Talk we a workaround we added:

    const interval = setInterval(function() {
        // eslint-disable-next-line no-undef
        if ($('.oc-dialog-dim').length === 0) {
            clearInterval(interval)
            EventBus.$emit('duplicateSessionDetected')
            window.location = generateUrl('/apps/spreed')
        }
    }, 3000)

This is as bad as it can get. Please help us to get rid of it and somehow trigger an event/callback or something so we can listen to the X properly (or even remove the X).

cc @nextcloud/javascript

1. to develop bug javascript

Most helpful comment

Okay, gimme 10 minutes

All 4 comments

This won't help here for a short term solution but I think this should be moved into a proper lazy (Vue) component and an API that gives you a promise. When the user clicks X then the promise shall be rejected. And all that should be added to https://github.com/nextcloud/nextcloud-dialogs/

Would it make sense to call the already given callback with false if the x is pressed? I kind of don't want to get rid of the x because the user might get confused about UI elements existing for some dialogs and not existing for others.

For mecalling with the cancel option would be expected and is exactly what i do now.
I just didn't fine the right place in this legacy code to do that

Okay, gimme 10 minutes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blackcrack picture blackcrack  路  3Comments

georgehrke picture georgehrke  路  3Comments

Django-BOfH picture Django-BOfH  路  3Comments

rullzer picture rullzer  路  3Comments

dl5rcw picture dl5rcw  路  3Comments