close text modal on escape press
This commit is contained in:
parent
8809ea6667
commit
f71b025db6
1 changed files with 6 additions and 2 deletions
|
@ -215,9 +215,13 @@ class Dialog {
|
||||||
this.$el.querySelectorAll("[close]").forEach((el) => {
|
this.$el.querySelectorAll("[close]").forEach((el) => {
|
||||||
el.addEventListener("click", (e) => this.hide());
|
el.addEventListener("click", (e) => this.hide());
|
||||||
});
|
});
|
||||||
this.$el.querySelectorAll("[role=\"textbox\"]").forEach((el) => {
|
this.$el.querySelectorAll('[role="textbox"]').forEach((el) => {
|
||||||
el.addEventListener("click", (e) => this.hide());
|
el.addEventListener("keypress", (e) => {
|
||||||
|
if (e.key == "Escape") {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
this.$autoFocus = this.$el.querySelector("[autofocus]");
|
this.$autoFocus = this.$el.querySelector("[autofocus]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue