Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal dialog closes when dragging and releasing mouse button outside dialog #13816

Closed
tdesmet opened this issue Jun 13, 2014 · 12 comments · Fixed by #14724 or #15881
Closed

Modal dialog closes when dragging and releasing mouse button outside dialog #13816

tdesmet opened this issue Jun 13, 2014 · 12 comments · Fixed by #14724 or #15881
Labels
Milestone

Comments

@tdesmet
Copy link

tdesmet commented Jun 13, 2014

When clicking and holding the left mouse button inside a modal dialog and then dragging the mouse outside the dialog and releasing the mouse button results in the modal dialog closing.

I have a use case where you can crop an image inside a dialog and when the users drags his mouse to far and releases the mouse button the dialog closes, causing the user to restart the process.

I know I can make the backdrop static so it doesn't close when clicking on it, but this would be a last resort.

I think that the backdrop should only close if the mousedown event happened on the backdrop and not on the dialog.

@hnrch02
Copy link
Collaborator

hnrch02 commented Jun 13, 2014

@mdo Does that sound reasonable?

@cvrebert cvrebert added this to the v3.2.1 milestone Jun 13, 2014
@mdo
Copy link
Member

mdo commented Jun 18, 2014

If it can be prevented in the JS, yeah, makes sense to me to address.

@fat
Copy link
Member

fat commented Jul 6, 2014

fixed

@fat fat closed this as completed Jul 6, 2014
fat added a commit that referenced this issue Jul 6, 2014
Use mousedown instead of click for backdrop click detection; fixes #13816
@surjithctly
Copy link

Modal box closing when clicked on Scroll bar (Chrome / Win 7). Able to scroll modal with mouse wheel, but can't scroll with scroll bar because of this fix.

@hnrch02
Copy link
Collaborator

hnrch02 commented Jul 28, 2014

@surjithctly Please open a new issue.

@twbs twbs locked and limited conversation to collaborators Jul 28, 2014
@cvrebert
Copy link
Collaborator

X-Ref: #14287.

@twbs twbs unlocked this conversation Sep 8, 2014
@hnrch02 hnrch02 reopened this Sep 8, 2014
@hnrch02 hnrch02 closed this as completed in 18c0a1c Sep 8, 2014
@hnrch02
Copy link
Collaborator

hnrch02 commented Sep 8, 2014

The fix for this has been reverted due to #14263.

@hnrch02 hnrch02 reopened this Sep 8, 2014
fat added a commit that referenced this issue Oct 3, 2014
Saranya-Raaj pushed a commit to Saranya-Raaj/bootstrap that referenced this issue Oct 9, 2014
fat added a commit that referenced this issue Oct 10, 2014
fat added a commit that referenced this issue Oct 10, 2014
fixes #13816 Modal dialog closes when dragging and releasing mouse button outside dialog
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
@lavaturtle
Copy link

This is still an issue when cropping images inside non-static modals. Doing something with stopPropagation is not an effective workaround when using a third-party cropping library like Jcrop. Temporarily making the modal static while cropping is also not workable in my use case. Are there any plans to re-fix this issue?

@Rupinderthind
Copy link

try
.modal{ pointer-events: none; .modal-dialog{ pointer-events: none; .modal-content{ pointer-events: auto; } } }

@Racle
Copy link

Racle commented Apr 15, 2019

try
.modal{ pointer-events: none; .modal-dialog{ pointer-events: none; .modal-content{ pointer-events: auto; } } }

Just FYI, this fix breaks scrolling on chrome when modal height is more than screen height.

It's also odd, that it's usually happens on wider screen, but on smaller screen it's seems to be working just fine. Changing screen size randomly make this work, and randomly breaking.

I believe this is chrome bug, as Firefox handles pointer-events and scrolling differently, and this fix works with Firefox.

@stephen304
Copy link

Just FYI, this fix breaks scrolling on chrome when modal height is more than screen height.

This may be relevant to finding a fix, but in my case, scrolling only breaks if the page itself lacks a scroll bar. Ie, if my page doesn't scroll, the modal won't scroll. Resizing the window by 1px to give the page a scroll bar causes scrolling to work again with the modal even though the modal still exceeds the page and window height, so it doesn't seem to actually depend on the modal height, but rather the presence of a scroll bar on the page.

@mewalig
Copy link

mewalig commented May 10, 2019

Can anyone suggest where I can set a breakpoint that will break after the triggering event has occurred, but before the modal has closed?

Answering my own question: Modal.prototype.hide in bootstrap.js. Now to find the triggering event code...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment