Issue Bug Closed

#89173Notification actions broken after document change

Andreas Kienast 09/14/19, 10:07 updated 12/23/19, 22:42

Description

If a notification with actions is triggered within an iframe, the actions are broken after the iframe document changes. This is due to broken scopes when the notification is generated.

Following code is invoked in list_frame which renders a notification:

require(['TYPO3/CMS/Backend/Notification', 'TYPO3/CMS/Backend/ActionButton/DeferredAction'], function(Notification, DeferredAction) {
    Notification.info('Foo', 'Yadda yadda.', 0, [
        {
            label: 'Revert\u0020update',
            action: new DeferredAction(function() {
                return new Promise(resolve => setTimeout(() => { console.log('DONE'); resolve('foobar'); }, 1000));
            })
        }
    ]);
});

If e.g. another backend module is loaded, the click event in the notification gets lost and the callback cannot be executed anymore.

Reviews 1