From 0c9b7ef4114d98e2bd744da569eb57fe5ca2c297 Mon Sep 17 00:00:00 2001 From: Shmuel Melamud Date: Sun, 13 Aug 2023 22:14:10 +0300 Subject: [PATCH] Do now close DelayedPopover when clicking an item in a dropdown menu. --- src/ui/control/DelayedPopper.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/control/DelayedPopper.tsx b/src/ui/control/DelayedPopper.tsx index 186009870..b5db74a36 100644 --- a/src/ui/control/DelayedPopper.tsx +++ b/src/ui/control/DelayedPopper.tsx @@ -53,7 +53,11 @@ class Manager extends React.PureComponent { } isInPopover(event: MouseEvent) { - for (let element of document.querySelectorAll(".popover-body").values()) { + return this.isInElements(event, ".popover-body") || this.isInElements(event, ".dropdown-menu"); + } + + isInElements(event: MouseEvent, selector: string) { + for (let element of document.querySelectorAll(selector).values()) { const r = element.getBoundingClientRect(); if (r.left <= event.clientX && r.right >= event.clientX && r.top <= event.clientY && r.bottom >= event.clientY) {