diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 543297ee79..1a7b21ed38 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -1354,9 +1354,8 @@ export class OverlayBackground implements OverlayBackgroundInterface { } } - private async triggerSubFrameFocusInRebuild({ sender }: chrome.runtime.Port) { + private async triggerSubFrameFocusInRebuild(sender: chrome.runtime.MessageSender) { await this.rebuildSubFrameOffsets(sender); - this.cancelUpdateInlineMenuPositionSubject.next(); this.repositionInlineMenuSubject.next(sender); } diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts index 1efd1356cf..122cf84a78 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts @@ -901,17 +901,6 @@ describe("AutofillOverlayContentService", () => { }); }); - it("clears the user interaction timeout", async () => { - jest.useFakeTimers(); - const clearTimeoutSpy = jest.spyOn(globalThis, "clearTimeout"); - autofillOverlayContentService["userInteractionEventTimeout"] = setTimeout(jest.fn(), 123); - - globalThis.dispatchEvent(new Event(EVENTS.SCROLL)); - await flushPromises(); - - expect(clearTimeoutSpy).toHaveBeenCalledWith(expect.anything()); - }); - it("removes the overlay completely if the field is not focused", async () => { jest.useFakeTimers(); jest @@ -1691,14 +1680,6 @@ describe("AutofillOverlayContentService", () => { autofillOverlayContentService["mostRecentlyFocusedField"] = autofillFieldElement; }); - it("clears the user interaction event timeout", () => { - jest.spyOn(autofillOverlayContentService as any, "clearUserInteractionEventTimeout"); - - autofillOverlayContentService.destroy(); - - expect(autofillOverlayContentService["clearUserInteractionEventTimeout"]).toHaveBeenCalled(); - }); - it("de-registers all global event listeners", () => { jest.spyOn(globalThis.document, "removeEventListener"); jest.spyOn(globalThis, "removeEventListener"); 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 49bedb49ad..a8315bf366 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -53,11 +53,8 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ private focusableElements: FocusableElement[] = []; private mostRecentlyFocusedField: ElementWithOpId; private focusedFieldData: FocusedFieldData; - private userInteractionEventTimeout: number | NodeJS.Timeout; - private recalculateSubFrameOffsetsTimeout: number | NodeJS.Timeout; private closeInlineMenuOnRedirectTimeout: number | NodeJS.Timeout; private focusInlineMenuListTimeout: number | NodeJS.Timeout; - private closeInlineMenuOnFilledFieldTimeout: number | NodeJS.Timeout; private eventHandlersMemo: { [key: string]: EventListener } = {}; private readonly extensionMessageHandlers: AutofillOverlayContentExtensionMessageHandlers = { openAutofillInlineMenu: ({ message }) => this.openInlineMenu(message), @@ -510,13 +507,6 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ await this.sendExtensionMessage("updateIsFieldCurrentlyFocused", { isFieldCurrentlyFocused: true, }); - if (this.userInteractionEventTimeout) { - this.clearUserInteractionEventTimeout(); - void this.toggleInlineMenuHidden(false, true); - void this.sendExtensionMessage("closeAutofillInlineMenu", { - forceCloseInlineMenu: true, - }); - } const initiallyFocusedField = this.mostRecentlyFocusedField; await this.updateMostRecentlyFocusedField(formFieldElement); @@ -582,19 +572,6 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ }); } - /** - * Sends a message that facilitates hiding the inline menu elements. - * - * @param isHidden - Indicates if the inline menu elements should be hidden. - * @param setTransparentInlineMenu - Indicates if the inline menu is closing. - */ - private toggleInlineMenuHidden(isHidden: boolean, setTransparentInlineMenu: boolean = false) { - void this.sendExtensionMessage("toggleAutofillInlineMenuHidden", { - isInlineMenuHidden: isHidden, - setTransparentInlineMenu, - }); - } - /** * Updates the data used to position the inline menu elements in relation * to the most recently focused form field. @@ -1118,32 +1095,6 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ ); } - /** - * Clears the user interaction event timeout. This is used to ensure that - * the overlay is not repositioned while the user is interacting with it. - */ - private clearUserInteractionEventTimeout() { - if (this.userInteractionEventTimeout) { - globalThis.clearTimeout(this.userInteractionEventTimeout); - this.userInteractionEventTimeout = null; - } - } - - private clearCloseInlineMenuOnFilledFieldTimeout() { - if (this.closeInlineMenuOnFilledFieldTimeout) { - globalThis.clearTimeout(this.closeInlineMenuOnFilledFieldTimeout); - } - } - - /** - * Clears the timeout that facilitates recalculating the sub frame offsets. - */ - private clearRecalculateSubFrameOffsetsTimeout() { - if (this.recalculateSubFrameOffsetsTimeout) { - globalThis.clearTimeout(this.recalculateSubFrameOffsetsTimeout); - } - } - private clearFocusInlineMenuListTimeout() { if (this.focusInlineMenuListTimeout) { globalThis.clearTimeout(this.focusInlineMenuListTimeout); @@ -1157,9 +1108,6 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ } private clearAllTimeouts() { - this.clearUserInteractionEventTimeout(); - this.clearCloseInlineMenuOnFilledFieldTimeout(); - this.clearRecalculateSubFrameOffsetsTimeout(); this.clearFocusInlineMenuListTimeout(); this.clearCloseInlineMenuOnRedirectTimeout(); }