A11Y: Allow dismissing the discard drafts modal via keyboard (#29802)

This commit is contained in:
Penar Musaraj 2024-11-18 15:43:36 -05:00 committed by GitHub
parent d85bc1eff6
commit f1849199e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View File

@ -21,7 +21,7 @@ export default class DiscardDraftModal extends Component {
<DModal
@closeModal={{@closeModal}}
class="discard-draft-modal"
@dismissable={{false}}
@hideHeader={{true}}
>
<:body>
<div class="instructions" role="heading" aria-level="1">

View File

@ -994,6 +994,31 @@ acceptance("Composer", function (needs) {
await click(".save-or-cancel .cancel");
assert.dom(".discard-draft-modal .save-draft").exists();
});
test("Discard drafts modal can be dismissed via keyboard", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .create");
await fillIn(".d-editor-input", "[quote]some quote[/quote]");
await click(".save-or-cancel .cancel");
assert.dom(".discard-draft-modal .save-draft").exists();
await triggerKeyEvent(
".discard-draft-modal .save-draft",
"keydown",
"Escape"
);
assert.dom(".discard-draft-modal").doesNotExist();
assert
.dom(".d-editor-input")
.hasValue(
"[quote]some quote[/quote]",
"composer textarea is not cleared"
);
});
});
acceptance("Composer - Customizations", function (needs) {