ember-modal-dialog icon indicating copy to clipboard operation
ember-modal-dialog copied to clipboard

Modal is closed when the click event is started inside the modal and ended on overlay

Open rnuyts opened this issue 6 years ago • 6 comments
trafficstars

In our Ember application, we use ember-modal-dialog. Inside one of the modals, we have a slider control. If the user starts to click in the modal content and ends the click on the overlay, it closes the modal.

When I try the same operation in the examples (here : http://yapplabs.github.io/ember-modal-dialog/) it does the same.

Is there a solution to make it working like the Boostrap modals ? When the mousedown is triggered inside the modal and the mouseup is triggered on the overaly, the modal is not closed. If you want to close the modal, you have to do the mousedown and the mouseup on the overlay.

Is there a workaround to fix this behavior ?

Thank you in advance for your help

rnuyts avatar Oct 11 '19 07:10 rnuyts

would love to have a fix or workaround for this behavior as well.

spolloni avatar Oct 16 '19 15:10 spolloni

@remiuz, @spolloni You can use overlayPosition="sibling" for fix this

loxmys avatar Dec 23 '19 08:12 loxmys

@remiuz, @spolloni You can use overlayPosition="sibling" for fix this

Hi @loxmys, we tried the overlayPosition="sibling"and it fixed the problem of drag and drop. The problem is that we use sometimes two stacked modals and setting the overlayPosition to sibling seems to break the stack-ability of the modals.

overlayPosition="parent" : Screenshot from 2020-03-20 09-55-38

overlayPosition="sibling" : Screenshot from 2020-03-20 09-56-00

Any idea if there is a solution to make it working with the "sibling" as overlay position ?

rnuyts avatar Mar 20 '20 08:03 rnuyts

You shouldn't use nested modals (modal in modal).

In the Bootstrap docs, it says

Bootstrap only supports one modal window at a time. Nested modals aren’t supported as we believe them to be poor user experiences.

The solution should be swapping out the modals in the view: closing child modal will open back up parent vice versa.

vfuto avatar Mar 21 '20 11:03 vfuto

overlayPosition="sibling"

We are running into this issue as well. I tried the suggested workaround, but it didn't make a difference. Are there any plans to fix this issue?

MariannaAtPlay avatar Sep 22 '21 19:09 MariannaAtPlay

Using overlay position does prevent the closing (depending on some CSS hierarchy) though it seems like there should be a better native event listener to make sure that this is happening.

I tried to modify the actions to see if there was a quick work around by extending the component. I think that it is likely that to fix this there may need to be explicit listeners for mousedown and mouseup to determine if the click began on the modal and ended on the overlay.

rtablada avatar Jan 06 '22 19:01 rtablada