Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Tweak autofill and add animation (#541)
Leendert de Borstb46637f8a02e
diff --git a/browser-extensions/chrome/src/app/pages/CredentialsList.tsx b/browser-extensions/chrome/src/app/pages/CredentialsList.tsxindex d2d115b49..69879060c 100644--- a/browser-extensions/chrome/src/app/pages/CredentialsList.tsx+++ b/browser-extensions/chrome/src/app/pages/CredentialsList.tsx@@ -56,7 +56,7 @@ const CredentialsList: React.FC = () => {<ReloadButton onClick={onRefresh} /></div>{credentials.length === 0 ? (- <div className="text-gray-500 dark:text-gray-400 space-y-2">+ <div className="text-gray-500 dark:text-gray-400 space-y-2 mb-10"><p className="text-sm">Welcome to AliasVault!</p>diff --git a/browser-extensions/chrome/src/contentScript/Form.ts b/browser-extensions/chrome/src/contentScript/Form.tsindex e9bd1da5e..4b7fb83a9 100644--- a/browser-extensions/chrome/src/contentScript/Form.ts+++ b/browser-extensions/chrome/src/contentScript/Form.ts@@ -229,16 +229,54 @@ export function injectIcon(input: HTMLInputElement): void {* which some websites require before the "continue" button is enabled.*/function triggerInputEvents(element: HTMLInputElement) : void {- // Basic events+ // Create an overlay div that will show the highlight effect+ const overlay = document.createElement('div');++ // Initial positioning+ const updatePosition = () => {+ const rect = element.getBoundingClientRect();+ overlay.style.cssText = `+ position: fixed;+ z-index: 999999;+ pointer-events: none;+ top: ${rect.top}px;+ left: ${rect.left}px;+ width: ${rect.width}px;+ height: ${rect.height}px;+ background-color: rgba(244, 149, 65, 0.3);+ border-radius: ${getComputedStyle(element).borderRadius};+ animation: fadeOut 1.4s ease-out forwards;+ `;+ };++ updatePosition();++ // Add scroll event listener+ window.addEventListener('scroll', updatePosition);++ // Add keyframe animation+ const style = document.createElement('style');+ style.textContent = `+ @keyframes fadeOut {+ 0% { opacity: 1; transform: scale(1.02); }+ 100% { opacity: 0; transform: scale(1); }+ }+ `;+ document.head.appendChild(style);+ document.body.appendChild(overlay);++ // Remove overlay and cleanup after animation+ setTimeout(() => {+ window.removeEventListener('scroll', updatePosition);+ overlay.remove();+ style.remove();+ }, 1400);++ // Trigger eventselement.dispatchEvent(new Event('input', { bubbles: true }));element.dispatchEvent(new Event('change', { bubbles: true }));- /*- * For radio buttons, we need additional events in order for form validation- * to be triggered correctly.- */if (element.type === 'radio') {- // Click eventselement.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));element.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));element.dispatchEvent(new MouseEvent('click', { bubbles: true }));diff --git a/browser-extensions/chrome/src/contentScript/Popup.ts b/browser-extensions/chrome/src/contentScript/Popup.tsindex ec4372e86..657c75d61 100644--- a/browser-extensions/chrome/src/contentScript/Popup.ts+++ b/browser-extensions/chrome/src/contentScript/Popup.ts@@ -117,7 +117,10 @@ export function removeExistingPopup() : void {/*** Create auto-fill popup*/-export function createAutofillPopup(input: HTMLInputElement, credentials: Credential[]) : void {+export function createAutofillPopup(input: HTMLInputElement, credentials: Credential[] | undefined) : void {+ // Disable browser's native autocomplete to avoid conflicts with AliasVault's autocomplete.+ input.setAttribute('autocomplete', 'false');+const popup = createBasePopup(input);// Create credential list container with ID@@ -126,6 +129,10 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Credenpopup.appendChild(credentialList);// Add initial credentials+ if (!credentials) {+ credentials = [];+ }+const filteredCredentials = filterCredentials(credentials,window.location.href,@@ -862,12 +869,12 @@ 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':- if (response.credentials?.length) {- createAutofillPopup(input, response.credentials);- }+ createAutofillPopup(input, response.credentials);break;case 'LOCKED':diff --git a/browser-extensions/chrome/vite.config.js b/browser-extensions/chrome/vite.config.jsindex db1b95b6c..6831e1857 100644--- a/browser-extensions/chrome/vite.config.js+++ b/browser-extensions/chrome/vite.config.js@@ -45,7 +45,7 @@ export default defineConfig({},build: {watch: process.env.NODE_ENV === 'development' ? {- include: ['src/**', 'manifest.json'],+ include: ['src/**', 'manifest.json', 'contentScript.ts', 'background.ts'],} : null}});