Closed
Description
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();
}
},
...
},
...
}
Metadata
Metadata
Assignees
Labels
No labels