UX: correctly handles escape on emoji picker (#15351)

This commit is contained in:
Joffrey JAFFEUX 2021-12-17 16:18:33 +01:00 committed by GitHub
parent bec76f937c
commit e71cd73965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -215,6 +215,14 @@ export default Component.extend({
section && section.scrollIntoView();
},
@action
keydown(event) {
if (event.code === "Escape") {
this.onClose();
return false;
}
},
@action
onFilter(event) {
const emojiPicker = document.querySelector(".emoji-picker");

View File

@ -1,5 +1,5 @@
{{#if isActive}}
<div class="emoji-picker {{if @isActive "opened"}}">
<div {{on "keydown" (action "keydown")}} class="emoji-picker {{if @isActive "opened"}}">
<div class="emoji-picker-category-buttons">
{{#if recentEmojis.length}}
<button type="button" data-section="recent" {{action "onCategorySelection" "recent"}} class="btn btn-default category-button emoji">