A11Y: Keep composer as focused element when dismissing Link modal via keyboard (#17893)

This commit is contained in:
Penar Musaraj 2022-08-14 21:37:19 -04:00 committed by GitHub
parent a32019d1e7
commit c66d544cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -58,6 +58,7 @@ export default Controller.extend(ModalFunctionality, {
event.stopPropagation();
} else {
this.send("closeModal");
document.querySelector(".d-editor-input")?.focus();
}
break;
}

View File

@ -98,5 +98,13 @@ acceptance("Composer - Hyperlink", function (needs) {
query(".link-url").value.includes("http"),
"replaces link url field with internal link"
);
await triggerKeyEvent(".insert-link", "keydown", "Escape");
assert.strictEqual(
document.activeElement.classList.contains("d-editor-input"),
true,
"focus stays on composer after dismissing modal using Esc key"
);
});
});