Editor Esc Key inside Bootstrap Modal

Editor Esc Key inside Bootstrap Modal

HassanDomeDeneaHassanDomeDenea Posts: 29Questions: 10Answers: 0

Sometimes I use a datatable inside a bootrap Modal, or any other modal.
When trying to use an editor actions, and the lightbox appear, and deciding to cancel, the ESC key is usually used.
Anyway this will cause the editor lightbox to hide, and also the main bootstrap modal to hide also.
So is there a way to overide this problem? for example, **stopPropagation() **or something like this ?
And thanks.

This question has an accepted answers - jump to answer


  • colincolin Posts: 8,085Questions: 0Answers: 1,358
    Answer ✓

    You can control the behavior of the Escape key with form-options - see the onEsc property.


  • HassanDomeDeneaHassanDomeDenea Posts: 29Questions: 10Answers: 0

    Thank you for the reference and I tried it. Indeed I can change the behavior, but it seems that I can't stop the another bootstrap modal from hiding with using event.stopPropagation(). It seems that I should modify the bootstrap modal itself.
    Thank you.

  • allanallan Posts: 51,440Questions: 1Answers: 7,758 Site admin


    Good question - I think they are both listening at the top level of the document for the keyup event. You could try stopImmediatePropagation() but I'm not entirely certain that would give the desired result either - my concern is that the Bootstrap listener is actually added after the Editor one, so the Bootstrap modal will always disappear first.

    It might require a hook into the Bootstrap code to check for an Editor modal - if present then don't hide the Bootstrap one. You could do that if the Bootstrap hide.bs.modal event allows preventDefault() to stop the escape key doing anything, but it doesn't say anything about that in their documentation.


Sign In or Register to comment.