diff --git a/CHANGES.md b/CHANGES.md index 34aaf2d0b..ba798dd83 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ - [enable_smacks](https://conversejs.org/docs/html/configuration.html#enable-smacks) is not set to `true` by default. - Refactor some presence and status handling code from `converse-core` into `@converse/headless/converse-status`. +- It's now possible to navigate the emoji-picker via the keyboard arrow keys. - Add support for [notifications about affiliation change for users not in a room](https://xmpp.org/extensions/xep-0045.html#example-196) - Add support for [XEP-0424 Message Retraction](http://localhost:3080/extensions/xep-0424.html) diff --git a/src/converse-emoji-views.js b/src/converse-emoji-views.js index 2b10a2883..26280f58c 100644 --- a/src/converse-emoji-views.js +++ b/src/converse-emoji-views.js @@ -327,9 +327,6 @@ converse.plugins.add('converse-emoji-views', { ev.preventDefault(); ev.stopPropagation(); ev.target.blur(); - const category = this.model.get('current_category'); - // If there's no category, we're viewing search results. - const selector = category ? `ul[data-category="${category}"]` : 'ul'; this.disableArrowNavigation(); this.navigator.enable(); this.navigator.handleKeydown(ev); diff --git a/src/dom-navigator.js b/src/dom-navigator.js index 78c6acd90..db2e310f7 100644 --- a/src/dom-navigator.js +++ b/src/dom-navigator.js @@ -4,7 +4,6 @@ * This module started as a fork of Rubens Mariuzzo's dom-navigator. * @copyright Rubens Mariuzzo, JC Brand */ -import log from "@converse/headless/log"; import u from './utils/html'; @@ -105,6 +104,22 @@ class DOMNavigator { }; } + static getClosestElement (els, getDistance) { + const next = els.reduce((prev, curr) => { + const current_distance = getDistance(curr); + if (current_distance < prev.distance) { + return { + distance: current_distance, + element: curr + }; + } + return prev; + }, { + distance: Infinity + }); + return next.element; + } + /** * Create a new DOM Navigator. * @param { Element } container The container of the element to navigate. @@ -189,22 +204,6 @@ class DOMNavigator { } } - getClosestElement (els, getDistance) { - const next = els.reduce((prev, curr) => { - const current_distance = getDistance(curr); - if (current_distance < prev.distance) { - return { - distance: current_distance, - element: curr - }; - } - return prev; - }, { - distance: Infinity - }); - return next.element; - } - /** * @method DOMNavigator#getNextElement * @param {'down'|'right'|'left'|'up'} direction