From 5cfa99e5ae90cce373bf65481a6992d4ec0f87b6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 27 Jul 2019 22:38:59 +0200 Subject: [PATCH] Proper handling of click events for smilies --- .../files/js/WoltLabSuite/Core/Ui/Smiley/Insert.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Smiley/Insert.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Smiley/Insert.js index cccd1340a2..00a945eab4 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Smiley/Insert.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Smiley/Insert.js @@ -80,16 +80,14 @@ define(['EventHandler', 'EventKey'], function (EventHandler, EventKey) { * @protected */ _mousedown: function (event) { - if (!this._container.contains(event.target)) { - return; - } - - event.preventDefault(); - // Clicks may occur on a few different elements, but we are only looking for the image. var listItem = event.target.closest('li'); - var img = elBySel('img', listItem); - if (img) this._insert(img); + if (this._container.contains(listItem)) { + event.preventDefault(); + + var img = elBySel('img', listItem); + if (img) this._insert(img); + } }, /** -- 2.20.1