From 0fddf1bc5bd0c1e11cd50a15b1619359631cfdba Mon Sep 17 00:00:00 2001 From: Meesayen Date: Mon, 19 Feb 2024 14:29:04 +0100 Subject: [PATCH] chore: consider "contextmenu" event as a click outside event too --- gitbutler-ui/src/lib/clickOutside.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gitbutler-ui/src/lib/clickOutside.ts b/gitbutler-ui/src/lib/clickOutside.ts index 79db61d72..bc8347901 100644 --- a/gitbutler-ui/src/lib/clickOutside.ts +++ b/gitbutler-ui/src/lib/clickOutside.ts @@ -15,15 +15,19 @@ export function clickOutside( } } document.addEventListener('click', onClick, true); + document.addEventListener('contextmenu', onClick, true); return { destroy() { document.removeEventListener('click', onClick, true); + document.removeEventListener('contextmenu', onClick, true); }, update(opts: ClickOpts) { document.removeEventListener('click', onClick, true); + document.removeEventListener('contextmenu', onClick, true); if (opts.enabled !== undefined && !opts.enabled) return; trigger = opts.trigger; document.addEventListener('click', onClick, true); + document.addEventListener('contextmenu', onClick, true); } }; }