I would like to request an option within the Lightbox2 configuration panel, where we can toggle on or off the "close lightbox by clicking on the background overlay" and "close lightbox with shortcut keys" features. (Not sure if this is a code request or a user interface request -- or both?)

I would like the option to disable these features to avoid having new users inadvertently close the lightbox window. The scenario I want to avoid is one where a site visitor viewing a website within an iframe inadvertently clicks on the overlay, closes the lightbox, and loses their place or information they had collected.

A more specific example: Let's say the iframe opens up a google map, the user searches for a location, inadvertently clicks on the background overlay or types and 'x', 'o', or other shortcut close key, and they lose their map and have to start over. (I realize that once they click inside the google map, the shortcut keys no longer work, but if they were to click outside of the google site -- on to a lightbox overlay that no longer closed the lightbox when clicked on -- and then were to type a short cut key, they could again lose the lightbox.)

Essentially, I want to be able to limit users to one -- and only one -- very obvious (such as the "X" image) way to close the lightbox. There is nothing wrong with any of the ways users can currently close the lightbox. However, these ways (apart from the X image) are actually quite hidden and secret to visitors who have not used lightbox before.

For now, my quick fix hack has been to simply comment out the following lines in lightbox.js:

$('#overlay').click(function() { Lightbox.end(); return false; } ).hide();

Hopefully, this will not nuke lightbox or my site. ;)

So, that's my specific reason for this request, however it seems like the ability to turn any of the various features in any module on or off would be a basic desire among those who use them. In this case, I would think a default of having the feature on would be most desirable.

Thanks,

Mike

Comments

stella’s picture

I'll take a look.

However, in the latest dev version keyboard shortcuts are configurable, so you can effectively disable the keyboard shortcuts by not configuring any. :)

I really wouldn't recommend disabling keyboard shortcuts, you should consider accessibility issues when designing your site.

Cheers,
Stella

mry4n’s picture

Sweet, thanks!

Good point about the accessibility. Two questions on that:

1.) In all seriousness, if someone cannot click on a button or an X to close the lightbox, how would they ever have opened the lightbox to begin with? I'm guessing that in module development you don't worry how people get to your module, you just focus on what you can do within the module?

2.) Would it be possible to configure a combination of key strokes to close the window, such as alt+x ?

Is it a real pain to make things configurable?

stella’s picture

People with disabilities may use assistive technologies to navigate the internet. They open the lightbox in much the same way as they would open any internet link.

Key stroke combinations are not configurable, and I don't plan on implementing it any time soon. They may also conflict with built-in browser key combinations, which can vary from browser to browser.

Cheers,
Stella

stella’s picture

Status: Active » Fixed

I've implemented this feature and it will be included in the next dev release, available later today.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

stella’s picture

Released in Lightbox2 6.x-1.9 and 5.x-2.9.

Cheers,
Stella