Feature: Allow disabling of modal close on Esc key.
See original GitHub issueSimilar 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:
- Created 6 years ago
- Comments:9 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Merged
Pull request #247