From 62d1114badff554d3c27b0702290ef032d0fac26 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Fri, 17 Dec 2021 12:29:52 -0500 Subject: [PATCH] DEV: Fix linting issue with emoji `keydown` event (#15352) --- .../javascripts/discourse/app/components/emoji-picker.js | 9 +++++++-- .../discourse/app/templates/components/emoji-picker.hbs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker.js b/app/assets/javascripts/discourse/app/components/emoji-picker.js index 3c0f3c85468..7e398ef082a 100644 --- a/app/assets/javascripts/discourse/app/components/emoji-picker.js +++ b/app/assets/javascripts/discourse/app/components/emoji-picker.js @@ -89,6 +89,8 @@ export default Component.extend({ return; } + emojiPicker.addEventListener("keydown", this._keyDown); + const textareaWrapper = document.querySelector( ".d-editor-textarea-wrapper" ); @@ -137,6 +139,9 @@ export default Component.extend({ @action onClose() { document.removeEventListener("click", this.handleOutsideClick); + document + .querySelector(".emoji-picker") + ?.removeEventListener("keydown", this._keyDown); this.onEmojiPickerClose && this.onEmojiPickerClose(); }, @@ -215,8 +220,8 @@ export default Component.extend({ section && section.scrollIntoView(); }, - @action - keydown(event) { + @bind + _keyDown(event) { if (event.code === "Escape") { this.onClose(); return false; diff --git a/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbs b/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbs index f41a27cb20b..68b2c0865cf 100644 --- a/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbs @@ -1,5 +1,5 @@ {{#if isActive}} -
+
{{#if recentEmojis.length}}