IfnotFr / PopConfirm

A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover
MIT License
99 stars 35 forks source link

Open popovers do not close when another PopConfirm popover is triggered #1

Closed bhall7 closed 10 years ago

bhall7 commented 10 years ago

Thanks for the great work on this plugin!

One thing I noticed is that if you have multiple rows of items in a list, each with their own button which triggers .popConfirm(), then triggering more than one PopConfirm popover does not close any other open popovers. This could result in a confusing user experience if multiple buttons were clicked: multiple_popconfirm_popovers The ideal behavior would be to only allow one PopConfirm popover open at a time (or make it an option to only show one PopConfirm popover at a time).

Thanks!

IfnotFr commented 10 years ago

Hi,

Yep you're right, i noticed the problem before, i will check and resolve this issue when i have the time :)

Thanks for your feedback !

bhall7 commented 10 years ago

This is fixed for any triggers/buttons of the same class; however, I noticed that if there are two triggers of two different classes, then it is still possible to open two PopConfirm popovers simultaneously, which could create user confusion:

duelingpopconfirms

IfnotFr commented 10 years ago

Can you guive me a example page / code for reproduce this bug ? Thanks :)

bhall7 commented 10 years ago

I tried to put an example together on both Bootply and JSFiddle, but it wouldn't allow it (403 forbidden error). But, if you look at the example, you will be able to reproduce the above issue where if PopConfirm is called from a different class, multiple instances can be triggered simultaneously, causing confusion.

IfnotFr commented 10 years ago

Do you mean that you have several popConfirm js instantiations ?

Like that :

$(".class1").popConfirm(); $(".class2").popConfirm();

And the problem still persist across two classes ?

bhall7 commented 10 years ago

Yes. That is correct. There may be two different buttons that both trigger a popConfirm, but have different options and questions, etc. Here's what I think would make the most sense:

User clicks on $(".class1").popConfirm(); to trigger a popConfirm popover. User then clicks $(".class2").popConfirm(); and $(".class1").popConfirm(); toggles closed. In other words, only one popConfirm popover would be allowed at a time, regardless of the class from which it was called.

IfnotFr commented 10 years ago

Ok i will see for that too, maybe #3 will fix this problem in a more elegant way :)

IfnotFr commented 10 years ago

The lastest fix did not fix this problem, if someone has an idea, I'm interested :)

PS : I updated test pages for showing your case.

bhall7 commented 10 years ago

Here's an example of multiple PopConfirm popovers being open (called from different classes): http://jsfiddle.net/bhall7x/Y4t8a/6/

IfnotFr commented 10 years ago

Problem fixed with #10 when merge ok :)