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); } }; }