From 25bec0e5b316a951f37bb2aa7065cd0df3aa3f41 Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Fri, 12 Jun 2026 15:10:23 -0400 Subject: [PATCH] [PM-38992] Fix Targeting Rules autofilling new password inputs with current password values (#21238) * fix Targeting Rules autofilling new password inputs with current password values * fix Targeting Rules not being used for explicitly defined new password field inline menu typing --- .../autofill/services/autofill-overlay-content.service.ts | 6 ++++++ apps/browser/src/autofill/services/autofill.service.ts | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index 09cd3649962..5551057f62e 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -3,6 +3,7 @@ import "lit/polyfill-support.js"; import { FocusableElement, tabbable } from "tabbable"; import { + AutofillTargetingRuleTypes, AUTOFILL_OVERLAY_HANDLE_REPOSITION, AUTOFILL_OVERLAY_HANDLE_SCROLL, AUTOFILL_TRIGGER_FORM_FIELD_SUBMIT, @@ -1177,6 +1178,11 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ // which are distinct from the heuristic AutofillFieldQualifierType values. const qualifier = autofillFieldData.fieldQualifier as AutofillTargetingRuleType; + if (qualifier === AutofillTargetingRuleTypes.newPassword) { + autofillFieldData.inlineMenuFillType = InlineMenuFillTypes.PasswordGeneration; + return; + } + if (loginQualifiers.includes(qualifier)) { autofillFieldData.inlineMenuFillType = CipherType.Login; return; diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts index 7108f8de862..49b2ef3cff7 100644 --- a/apps/browser/src/autofill/services/autofill.service.ts +++ b/apps/browser/src/autofill/services/autofill.service.ts @@ -921,12 +921,12 @@ export default class AutofillService implements AutofillServiceInterface { if (fieldType === AutofillTargetingRuleTypes.username) { return cipher.login?.username ?? null; } - if ( - fieldType === AutofillTargetingRuleTypes.password || - fieldType === AutofillTargetingRuleTypes.newPassword - ) { + if (fieldType === AutofillTargetingRuleTypes.password) { return cipher.login?.password ?? null; } + if (fieldType === AutofillTargetingRuleTypes.newPassword) { + return null; + } // Card fields if (fieldType === AutofillTargetingRuleTypes.cardholderName) {