ngx-lightbox icon indicating copy to clipboard operation
ngx-lightbox copied to clipboard

There is no way to stop event propagation

Open narekharutyunyan opened this issue 5 years ago • 3 comments

I've my lightbox control in modal dialog and when I press "Esc" it closes both lightbox and dialog.

I would be great if you can extend this._lightboxEvent.broadcastLightboxEvent method to pass $event as well (this._lightboxEvent.broadcastLightboxEvent({..., $event: $event})) so preventDefault() can be called from client side.

ightboxComponent.prototype._keyboardAction = function ($event) {
        var KEYCODE_ESC = 27;
        var KEYCODE_LEFTARROW = 37;
        var KEYCODE_RIGHTARROW = 39;
        var keycode = $event.keyCode;
        var key = String.fromCharCode(keycode).toLowerCase();
        if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
            this._lightboxEvent.broadcastLightboxEvent({ id: lightbox_event_service_1.LIGHTBOX_EVENT.CLOSE, data: null });

narekharutyunyan avatar Jul 25 '19 21:07 narekharutyunyan

Hi, I'm encountering the same behavior - open lightbox from a modal dialog and ESC closes both lightbox and the dialog.

A method to stop the event propagation would be great - maybe pass the vent as suggested, or a new option.

tomwillwerth avatar Oct 22 '19 10:10 tomwillwerth

I'm working it around by checking if lightbox is open in my dialog close code and ignoring ESC if so.

unxed avatar Jun 25 '20 13:06 unxed

Hi, no updates about this?

emilianobaldo avatar Jul 07 '23 13:07 emilianobaldo