From 582cdf17dd7fa8d7fb398ad2aa50cf5301327396 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Tue, 25 Jun 2024 08:10:08 -0500 Subject: [PATCH] [PM-5189] Working through further issues on positioning of inline menu --- .../background/abstractions/overlay.background.ts | 2 +- .../browser/src/autofill/background/overlay.background.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/browser/src/autofill/background/abstractions/overlay.background.ts b/apps/browser/src/autofill/background/abstractions/overlay.background.ts index 1acab3e0e12..159ba996519 100644 --- a/apps/browser/src/autofill/background/abstractions/overlay.background.ts +++ b/apps/browser/src/autofill/background/abstractions/overlay.background.ts @@ -113,7 +113,7 @@ export type OverlayBackgroundExtensionMessageHandlers = { getAutofillInlineMenuVisibility: () => void; openAutofillInlineMenu: () => void; closeAutofillInlineMenu: ({ message, sender }: BackgroundOnMessageHandlerParams) => void; - checkAutofillInlineMenuFocused: () => void; + checkAutofillInlineMenuFocused: ({ sender }: BackgroundSenderParam) => void; focusAutofillInlineMenuList: () => void; updateAutofillInlineMenuPosition: ({ message, diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 4a6a12bd696..0a3e924c9b5 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -90,7 +90,7 @@ export class OverlayBackground implements OverlayBackgroundInterface { getAutofillInlineMenuVisibility: () => this.getInlineMenuVisibility(), openAutofillInlineMenu: () => this.openInlineMenu(false), closeAutofillInlineMenu: ({ message, sender }) => this.closeInlineMenu(sender, message), - checkAutofillInlineMenuFocused: () => this.checkInlineMenuFocused(), + checkAutofillInlineMenuFocused: ({ sender }) => this.checkInlineMenuFocused(sender), focusAutofillInlineMenuList: () => this.focusInlineMenuList(), updateAutofillInlineMenuPosition: ({ message, sender }) => this.updateInlineMenuPosition(message, sender), @@ -518,7 +518,11 @@ export class OverlayBackground implements OverlayBackgroundInterface { * Checks if the inline menu is focused. Will check the inline menu list * if it is open, otherwise it will check the inline menu button. */ - private checkInlineMenuFocused() { + private checkInlineMenuFocused(sender: chrome.runtime.MessageSender) { + if (sender.tab.id !== this.focusedFieldData?.tabId) { + return; + } + if (this.inlineMenuListPort) { this.checkInlineMenuListFocused();