mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 00:49:45 +01:00
Fix context menu closing immediately when using ctrl+click
https://feedback.yaak.app/p/right-click-on-mac-automatically-closes
This commit is contained in:
@@ -29,10 +29,12 @@ export function useClickOutside(
|
||||
savedCallback.current(event);
|
||||
}
|
||||
};
|
||||
document.addEventListener('click', handler, { capture: true });
|
||||
// NOTE: We're using mousedown instead of click to handle some edge cases like when a context
|
||||
// menu is open with the ctrl key.
|
||||
document.addEventListener('mousedown', handler, { capture: true });
|
||||
document.addEventListener('contextmenu', handler, { capture: true });
|
||||
return () => {
|
||||
document.removeEventListener('click', handler);
|
||||
document.removeEventListener('mousedown', handler);
|
||||
document.removeEventListener('contextmenu', handler);
|
||||
};
|
||||
}, [ignored, ref]);
|
||||
|
||||
Reference in New Issue
Block a user