Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Keep icon visible after click (#541)
Leendert de Borst20c44ec73742
diff --git a/browser-extensions/chrome/src/contentScript/Form.ts b/browser-extensions/chrome/src/contentScript/Form.tsindex 4b7fb83a9..d645e81af 100644--- a/browser-extensions/chrome/src/contentScript/Form.ts+++ b/browser-extensions/chrome/src/contentScript/Form.ts@@ -164,9 +164,10 @@ export function injectIcon(input: HTMLInputElement): void {input.id = `aliasvault-input-${Math.random().toString(36).substr(2, 9)}`;}- // Don't inject if already exists- if (document.querySelector(`[data-icon-for="${input.id}"]`)) {- return;+ // Remove existing icon if one already exists+ const existingIcon = document.querySelector(`[data-icon-for="${input.id}"]`);+ if (existingIcon) {+ existingIcon.remove();}const iconDiv = document.createElement('div');diff --git a/browser-extensions/chrome/src/contentScript/Popup.ts b/browser-extensions/chrome/src/contentScript/Popup.tsindex 657c75d61..e2e4f65c1 100644--- a/browser-extensions/chrome/src/contentScript/Popup.ts+++ b/browser-extensions/chrome/src/contentScript/Popup.ts@@ -1,6 +1,6 @@import { isDarkMode } from './Shared';import { Credential } from '../shared/types/Credential';-import { fillCredential } from './Form';+import { fillCredential, injectIcon } from './Form';import { filterCredentials } from './Filter';import { IdentityGeneratorEn } from '../shared/generators/Identity/implementations/IdentityGeneratorEn';import { PasswordGenerator } from '../shared/generators/Password/PasswordGenerator';@@ -380,8 +380,10 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden// Add the event listener for clicking outsidedocument.addEventListener('mousedown', handleClickOutside);-document.body.appendChild(popup);++ // When creating the popup, also (re)create the icon so it stays visible.+ injectIcon(input);}/**@@ -469,6 +471,9 @@ export function createVaultLockedPopup(input: HTMLInputElement): void {}, 100);document.body.appendChild(popup);++ // When creating the popup, also (re)create the icon so it stays visible.+ injectIcon(input);}/**@@ -869,9 +874,7 @@ export function openAutofillPopup(input: HTMLInputElement) : void {document.addEventListener('keydown', handleEnterKey);// Request credentials from background script- console.log('requesting credentials');chrome.runtime.sendMessage({ type: 'GET_CREDENTIALS' }, (response: CredentialResponse) => {- console.log('got response', response);switch (response.status) {case 'OK':createAutofillPopup(input, response.credentials);