diff --git a/apps/browser-extension/src/utils/formDetector/FormDetector.ts b/apps/browser-extension/src/utils/formDetector/FormDetector.ts index 8666d6d73..e65f7f45d 100644 --- a/apps/browser-extension/src/utils/formDetector/FormDetector.ts +++ b/apps/browser-extension/src/utils/formDetector/FormDetector.ts @@ -246,12 +246,17 @@ export class FormDetector { * @returns True if the field matches exclusion patterns and should be excluded from autofill. */ private matchesExclusionPatterns(input: HTMLInputElement): boolean { - // Collect all text attributes to check + /* + * Collect text attributes to check. The `class` attribute is intentionally + * excluded: utility-CSS frameworks (Tailwind, DaisyUI, etc.) routinely emit + * tokens like `duration-100`, `outline-none`, `bg-base-100` whose + * word-boundary parts collide with generic exclusion words ("duration", + * "access", "settings", ...). + */ const attributesToCheck = [ input.id, input.getAttribute('name'), input.getAttribute('placeholder'), - input.getAttribute('class'), input.getAttribute('aria-label') ] .map(a => a?.toLowerCase() ?? '') diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.ts b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.ts index 62d835152..3ed6c331a 100644 --- a/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.ts +++ b/apps/browser-extension/src/utils/formDetector/__tests__/FormDetector.en.test.ts @@ -86,6 +86,13 @@ describe('FormDetector English tests', () => { testField(FormField.Email, 'account_name_text_field', htmlFile); }); + describe('English login form 5 detection (Tailwind, no form wrapper, placeholder-only labels)', () => { + const htmlFile = 'en-login-form5.html'; + + testField(FormField.Username, 'username-input', htmlFile); + testField(FormField.Password, 'password-input', htmlFile); + }); + describe('English registration form 8 detection (Roblox-style birthdate)', () => { const htmlFile = 'en-registration-form8.html'; diff --git a/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-login-form5.html b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-login-form5.html new file mode 100644 index 000000000..3ca3ba147 --- /dev/null +++ b/apps/browser-extension/src/utils/formDetector/__tests__/test-forms/en-login-form5.html @@ -0,0 +1,19 @@ + +
+

Enter your credentials

+
+
+

Username

+ +
+
+

Password

+ +
+ +