Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Close autofill on mouseclick outside (#541)

Leendert de Borst7c3f360a34e5
diff --git a/browser-extensions/chrome/src/contentScript.ts b/browser-extensions/chrome/src/contentScript.ts
index 8c212208f..0ca42220c 100644
--- a/browser-extensions/chrome/src/contentScript.ts
+++ b/browser-extensions/chrome/src/contentScript.ts
@@ -46,6 +46,19 @@ function createPopup(input: HTMLInputElement, credentials: Credential[]) : void
padding: 8px 0;
`;
+ // Change to mousedown event instead of click
+ const handleClickOutside = (event: MouseEvent) => {
+ if (!popup.contains(event.target as Node)) {
+ removeExistingPopup();
+ document.removeEventListener('mousedown', handleClickOutside);
+ }
+ };
+
+ // Use setTimeout to prevent immediate trigger of the mousedown event
+ setTimeout(() => {
+ document.addEventListener('mousedown', handleClickOutside);
+ }, 100);
+
// Position popup below input
const rect = input.getBoundingClientRect();
popup.style.top = `${rect.bottom + window.scrollY + 2}px`;