FIX: close modals on ESC key and clicking outside
This commit is contained in:
parent
64d51ab45e
commit
f686ab988f
|
@ -32,7 +32,7 @@ export default Component.extend({
|
|||
setUp() {
|
||||
$("html").on("keydown.discourse-modal", e => {
|
||||
if (e.which === 27 && this.dismissable) {
|
||||
Ember.run.next(() => $(".modal-header a.close").click());
|
||||
Ember.run.next(() => $(".modal-header button.modal-close").click());
|
||||
}
|
||||
|
||||
if (e.which === 13 && this.triggerClickOnEnter(e)) {
|
||||
|
@ -73,7 +73,7 @@ export default Component.extend({
|
|||
// Delegate click to modal close if clicked outside.
|
||||
// We do this because some CSS of ours seems to cover
|
||||
// the backdrop and makes it unclickable.
|
||||
$(".modal-header a.close").click();
|
||||
$(".modal-header button.modal-close").click();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ QUnit.test("Can open the category modal", async assert => {
|
|||
await click(".edit-category");
|
||||
assert.ok(visible(".d-modal"), "it pops up a modal");
|
||||
|
||||
await click("a.close");
|
||||
await click("button.modal-close");
|
||||
assert.ok(!visible(".d-modal"), "it closes the modal");
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue