mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 05:43:41 +00:00
[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:
@@ -65,6 +65,11 @@ export class AutoFillConstants {
|
|||||||
"checkbox",
|
"checkbox",
|
||||||
...AutoFillConstants.ExcludedAutofillLoginTypes,
|
...AutoFillConstants.ExcludedAutofillLoginTypes,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
static readonly ExcludedOverlayTypes: string[] = [
|
||||||
|
"textarea",
|
||||||
|
...AutoFillConstants.ExcludedAutofillTypes,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreditCardAutoFillConstants {
|
export class CreditCardAutoFillConstants {
|
||||||
|
|||||||
@@ -195,8 +195,8 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
expect(autofillFieldElement.addEventListener).not.toHaveBeenCalled();
|
expect(autofillFieldElement.addEventListener).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("ignores fields that are part of the ExcludedAutofillTypes", () => {
|
it("ignores fields that are part of the ExcludedOverlayTypes", () => {
|
||||||
AutoFillConstants.ExcludedAutofillTypes.forEach((excludedType) => {
|
AutoFillConstants.ExcludedOverlayTypes.forEach((excludedType) => {
|
||||||
autofillFieldData.type = excludedType;
|
autofillFieldData.type = excludedType;
|
||||||
|
|
||||||
autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
autofillOverlayContentService.setupAutofillOverlayListenerOnField(
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
private readonly findTabs = tabbable;
|
private readonly findTabs = tabbable;
|
||||||
private readonly sendExtensionMessage = sendExtensionMessage;
|
private readonly sendExtensionMessage = sendExtensionMessage;
|
||||||
private formFieldElements: Set<ElementWithOpId<FormFieldElement>> = new Set([]);
|
private formFieldElements: Set<ElementWithOpId<FormFieldElement>> = new Set([]);
|
||||||
|
private ignoredFieldTypes: Set<string> = new Set(AutoFillConstants.ExcludedOverlayTypes);
|
||||||
private userFilledFields: Record<string, FillableFormFieldElement> = {};
|
private userFilledFields: Record<string, FillableFormFieldElement> = {};
|
||||||
private authStatus: AuthenticationStatus;
|
private authStatus: AuthenticationStatus;
|
||||||
private focusableElements: FocusableElement[] = [];
|
private focusableElements: FocusableElement[] = [];
|
||||||
@@ -715,12 +716,11 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
|||||||
* @param autofillFieldData - Autofill field data captured from the form field element.
|
* @param autofillFieldData - Autofill field data captured from the form field element.
|
||||||
*/
|
*/
|
||||||
private isIgnoredField(autofillFieldData: AutofillField): boolean {
|
private isIgnoredField(autofillFieldData: AutofillField): boolean {
|
||||||
const ignoredFieldTypes = new Set(AutoFillConstants.ExcludedAutofillTypes);
|
|
||||||
if (
|
if (
|
||||||
autofillFieldData.readonly ||
|
autofillFieldData.readonly ||
|
||||||
autofillFieldData.disabled ||
|
autofillFieldData.disabled ||
|
||||||
!autofillFieldData.viewable ||
|
!autofillFieldData.viewable ||
|
||||||
ignoredFieldTypes.has(autofillFieldData.type) ||
|
this.ignoredFieldTypes.has(autofillFieldData.type) ||
|
||||||
this.keywordsFoundInFieldData(autofillFieldData, ["search", "captcha"])
|
this.keywordsFoundInFieldData(autofillFieldData, ["search", "captcha"])
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user