[PM-5806] Remove the Inline Auto-fill Menu From `textarea` Fields (#7655)

* [PM-5806] Remove the autofill overlay menu from textarea fields

* [PM-5806] Running prettier

* [PM-5806] Implementing a new AutofillConstant to more easily exclude overlay types

* [PM-5806] Implementing a new AutofillConstant to more easily exclude overlay types
This commit is contained in:
Cesar Gonzalez 2024-01-23 16:26:37 -06:00 committed by GitHub
parent 219bad0e42
commit 7436f9112d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -65,6 +65,11 @@ export class AutoFillConstants {
"checkbox",
...AutoFillConstants.ExcludedAutofillLoginTypes,
];
static readonly ExcludedOverlayTypes: string[] = [
"textarea",
...AutoFillConstants.ExcludedAutofillTypes,
];
}
export class CreditCardAutoFillConstants {

View File

@ -195,8 +195,8 @@ describe("AutofillOverlayContentService", () => {
expect(autofillFieldElement.addEventListener).not.toHaveBeenCalled();
});
it("ignores fields that are part of the ExcludedAutofillTypes", () => {
AutoFillConstants.ExcludedAutofillTypes.forEach((excludedType) => {
it("ignores fields that are part of the ExcludedOverlayTypes", () => {
AutoFillConstants.ExcludedOverlayTypes.forEach((excludedType) => {
autofillFieldData.type = excludedType;
autofillOverlayContentService.setupAutofillOverlayListenerOnField(

View File

@ -32,6 +32,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
private readonly findTabs = tabbable;
private readonly sendExtensionMessage = sendExtensionMessage;
private formFieldElements: Set<ElementWithOpId<FormFieldElement>> = new Set([]);
private ignoredFieldTypes: Set<string> = new Set(AutoFillConstants.ExcludedOverlayTypes);
private userFilledFields: Record<string, FillableFormFieldElement> = {};
private authStatus: AuthenticationStatus;
private focusableElements: FocusableElement[] = [];
@ -715,12 +716,11 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
* @param autofillFieldData - Autofill field data captured from the form field element.
*/
private isIgnoredField(autofillFieldData: AutofillField): boolean {
const ignoredFieldTypes = new Set(AutoFillConstants.ExcludedAutofillTypes);
if (
autofillFieldData.readonly ||
autofillFieldData.disabled ||
!autofillFieldData.viewable ||
ignoredFieldTypes.has(autofillFieldData.type) ||
this.ignoredFieldTypes.has(autofillFieldData.type) ||
this.keywordsFoundInFieldData(autofillFieldData, ["search", "captcha"])
) {
return true;