From 4f18b5e36c90f14b6492248b1aaa1544a3897148 Mon Sep 17 00:00:00 2001 From: Miguel Cerejo Date: Fri, 6 Oct 2023 18:14:48 +0100 Subject: [PATCH] Fix scrollbar click issue v2 #832 --- src/TributeEvents.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/TributeEvents.js b/src/TributeEvents.js index ee4936b2..95dc7f80 100644 --- a/src/TributeEvents.js +++ b/src/TributeEvents.js @@ -88,9 +88,14 @@ class TributeEvents { while (li.nodeName.toLowerCase() !== "li") { li = li.parentNode; if (!li || li === tribute.menu) { - throw new Error("cannot find the
  • container for the click"); + // When li === tribute.menu, it's either a click on the entire component or on the scrollbar (if visible) + li = undefined; + break; } } + if (!li) { + return; + } tribute.selectItemAtIndex(li.getAttribute("data-index"), event); tribute.hideMenu();