question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: Allow disabling of modal close on Esc key.

See original GitHub issue

Similar to disable close on clicking the backdrop, it would be nice to be able to disable closing of the modal by pressing ESC.

As well, could you not use @keyup.esc on the modal div to detect if the ESC key was pressed in while the modal was open (rather than binding the esc key detection on the document element?

<div key="modal" :id="id"
     v-show="visible"
     :class="['modal',{fade :fade}]"
     @click="onClickOut($event)"
     @keyup.esc="onEsc($event)"
>
export default {
  ...
  props {
    ...
    closeOnEsc: { type: Boolean, default: true },
    ...
  },
  methods {
    ...
    onEsc(e) {
      if (this.visible && this.closeOnEsc) {
        this.hide();
      }
    },
    ...
  },
  ...
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
tmorehousecommented, Apr 19, 2017

Merged

0reactions
tmorehousecommented, Apr 19, 2017

Pull request #247

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable Escape Key for Twitter Bootstrap Modals?
Removing the tabindex attribute does disable the Escape key, but only if the modal doesn't have an input field inside it.
Read more >
Bootstrap modal – disable closing with ESC key or mouse
Easily prevent modal windows from closing due to mouse clicks or escape key being pressed with Twitter Bootstrap. Force your modal to stay ......
Read more >
Cancel a React Modal with Escape Key or External Click
How do you cancel a React modal with an escape key or external click? ... Modals have a button that closes them without...
Read more >
How to disable closing modal window with ESC and ENTER ...
I had to disable closing modal popup by pressing ESC. ... Ctools modal content function to prevent closing the modal with * the...
Read more >
How to prevent closing ctools modal window with ESC?
I had similar kind of a problem. I had to disable closing modal popup by pressing ESC. In my case solution was adding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found