emoji picker: Use closest() to find map for mouseenter.

If we have two emoji pickers open for some reason,
we will now no longer be buggy for the mouseenter
event.
This commit is contained in:
Steve Howell 2020-06-18 16:30:26 +00:00 committed by Tim Abbott
parent 453e6d7b09
commit 5890a50c71
1 changed files with 3 additions and 3 deletions

View File

@ -717,11 +717,11 @@ exports.register_click_handlers = function () {
reset_emoji_showcase();
});
$("body").on("mouseenter", ".emoji-popover-emoji", function () {
const emoji_id = $(this).data("emoji-id");
$("body").on("mouseenter", ".emoji-popover-emoji", function (e) {
const emoji_id = $(e.currentTarget).data("emoji-id");
const emoji_coordinates = get_emoji_coordinates(emoji_id);
const $emoji_map = $(".emoji-popover-emoji-map");
const $emoji_map = $(e.currentTarget).closest(".emoji-popover-emoji-map").expectOne();
maybe_change_focused_emoji(
$emoji_map,
emoji_coordinates.section,