Reputation: 2777
I'm trying the aurelia-dialog plugin but want it to look/behave much more like Bootstrap Modal. One simple difference is that aurelia-dialog does not close when I press the Escape key. Without getting hacky and adding keyboard listeners, is there an easy way to activate the Escape key to close Aurelia-modal?
Here's a snippet of code to show how it's being instantiated:
this.dialogService.open({ viewModel: SettingsSchoolDivisionEdit, model: record }).then(response => {
if (!response.wasCancelled) {
console.log("Success");
}
});
Upvotes: 0
Views: 754
Reputation: 2777
I learned that the lock property is set to true by default and that it prevents the Escape key from working. To allow the Escape key to work, add lock: false
to the instantiation like this:
this.dialogService.open({ viewModel: SettingsSchoolDivisionEdit, model: record, lock: false }).then(response => {
if (!response.wasCancelled) {
console.log("Success");
}
});
Upvotes: 1