Closed (fixed)
Project:
Chaos Tool Suite (ctools)
Version:
7.x-1.x-dev
Component:
Modal
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Sep 2011 at 11:58 UTC
Updated:
4 Sep 2015 at 11:43 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerHere is a patch.
Comment #2
merlinofchaos commentedCommitted, pushed.
Comment #4
tomogden commentedBUG ALERT!
@merlinofchaos,
This patch doesn't work for Chrome or Safari because 'keypress' cannot capture the escape key. Binding the 'keypress' event also seems to conflict with the modalEventHandler binding above it.
I have attached a revised patch where the ONLY change is the 'keypress' event is replaced by the 'keydown' event in 3 places. This works in Chrome and Safari, as well as old and new versions of FireFox and eliminates any possible conflicts with modalEventHandler. I can't verify IE here, but maybe someone else can verify it for me.
Comment #5
dave reidComment #6
tim.plunkettThe current code binds to $(document) but unbinds $('body'). I couldn't get this to work in chrome/safari, with keypress, keyup, or keydown.
However, dreditor does something similar, and it *does* work: http://drupalcode.org/project/dreditor.git/blob/refs/heads/master:/dredi...
Comment #7
nagiek commentedNot meaning to hijack the thread, but could we also add a setting to dismiss the modal by clicking on the background?
Comment #8
nagiek commentedSimilar patch as #327139: Close lightbox when background overlay is clicked, but for using #modalBackdrop should do it.
Comment #9
merlinofchaos commentedI would want that to be an optional behavior; ESC can be standard, that's relatively normal and okay, but the background click, that strikes me as being way too easy to do by accident and causing lost work.
Comment #10
tim.plunkettMarking CNW per #6 and #9.
Comment #11
vgoodvin commentedI created patch to closing modal window by clicking on backdrop. I tested it in Chromium 18 and in Firefox 11. Escape button also didn't work for me in Chromium. So it also fixed.
Comment #12
vgoodvin commentedComment #13
tomogden commentedThis tests correctly for me on Chrome, Firefox and Safari on PC and Mac and IE8 on PC. Tested correctly also on Chromium 18 for Mac.
Comment #14
pixelmord commentedTested patch from #11 against CTOOLS 7.x-1.2.
Works fine for me in Safari and Chrome on Mac, other browsers I did not test up to now.
Thanks for the patch!
Comment #15
howto commentedThe patch from #11 works perfectly on Chrome, Firefox but it don't work on Chromium.
Comment #16
mrsinguyen commentedTested with patch #11, work fine for me.
Comment #17
socialnicheguru commentedit works for me too
Comment #18
dawehnerI'm not 100% familiar with the perfect way to write javascript but isn't using event.preventDefault();
the way to go?
Comment #19
merlinofchaos commentedYou know, I don't think clicking on the backdrop should close the modal. There's way too much possibility of data loss just for clicking on the background. Sorry, but I will not be committing this.
Comment #20
SebCorbin commentedErr, wasn't the subject about "escape key", not "backdrop click" ?
Comment #21
SebCorbin commentedSorry I was using version 7.x-1.2, this has been fixed by commit 0ec61b4
Comment #22
El Alemaño commentedComment #23
El Alemaño commentedComment #24
El Alemaño commentedComment #25
El Alemaño commented