Skip to content

Popups are closing if singleton is set to true #122

@Lovro1107

Description

@Lovro1107

I am having problems when setting singleton to true. When I click on a button the confirmation popup shows but then immediately closes.

My code:

$('body > .container > section').confirmation({
        rootSelector: 'body > .container > section',
        selector: '[data-toggle=confirmation]',
        singleton: true,
        placement: 'top',
        btnCancelLabel: 'PREKLIČI',
        btnCancelClass: 'btn-default btn-sm',
        btnCancelIcon: 'fa fa-back',
    });

What I was able to figure out was that _setConfirmationListeners() is executed twice when a button is clicked, so the function for managing singletons is also called twice.
The first time the element of the clicked button is passed as this to the function, but the second time the element from the rootSelector is passed as this and then popup is closed.
I didn't dig any deeper than this and don't know if this is will help you in any way (is this expected behaviour?) but I'm just sharing what I know.

I'm using Bootstrap v4.3.1 and jQuery v3.4.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions