diff --git a/src/plugins/sib-reactions.js b/src/plugins/sib-reactions.js index 7a3fbf0c134f86a9e5ab3f2fa3e66e32f5d559c3..eb9c9a42a78a4301f9c9101563dbf287e3e5fea7 100644 --- a/src/plugins/sib-reactions.js +++ b/src/plugins/sib-reactions.js @@ -232,6 +232,17 @@ converse.plugins.add('sib-reactions', { sendReactionStanza(self.model, emojis); }); + + // Focus the search input when the picker opens + const emojiSearch = picker.shadowRoot?.querySelector('.search'); + emojiSearch?.focus(); + + // Close the picker if the ESC key is pressed + picker.addEventListener('keydown', ev => { + if (ev.key === 'Escape') { + picker.remove(); + } + }); }, /** @@ -308,6 +319,17 @@ converse.plugins.add('sib-reactions', { sendReactionStanza(el.model, emojis); }); + + // Focus the search input when the picker opens + const emojiSearch = picker.shadowRoot?.querySelector('.search'); + emojiSearch?.focus(); + + // Close the picker if the ESC key is pressed + picker.addEventListener('keydown', ev => { + if (ev.key === 'Escape') { + picker.remove(); + } + }); }, 'button_class': 'chat-msg__action-react', 'icon_class': 'fa fa-smile',