1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-13 00:51:45 +01:00

[PM-5189] Fixing an issue with how scroll events trigger a reposition of the inline menu when the field is not focused;

This commit is contained in:
Cesar Gonzalez 2024-06-12 13:32:20 -05:00
parent c69a82a304
commit b1e75ad7b5
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
2 changed files with 1 additions and 30 deletions

View File

@ -1222,13 +1222,6 @@ describe("OverlayBackground", () => {
frameId: 2,
});
beforeEach(() => {
sendMockExtensionMessage({
command: "updateIsFieldCurrentlyFocused",
isFieldCurrentlyFocused: true,
});
});
it("returns false if the focused field data is not set", async () => {
sendMockExtensionMessage(
{ command: "checkShouldRepositionInlineMenu" },
@ -1258,24 +1251,6 @@ describe("OverlayBackground", () => {
expect(sendResponse).toHaveBeenCalledWith(false);
});
it("returns false if the field is not currently focused", async () => {
sendMockExtensionMessage({
command: "updateIsFieldCurrentlyFocused",
isFieldCurrentlyFocused: false,
});
const focusedFieldData = createFocusedFieldDataMock();
sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender);
sendMockExtensionMessage(
{ command: "checkShouldRepositionInlineMenu" },
sender,
sendResponse,
);
await flushPromises();
expect(sendResponse).toHaveBeenCalledWith(false);
});
it("returns true if the focused field's frame id is equal to the sender's frame id", async () => {
const focusedFieldData = createFocusedFieldDataMock();
sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender);

View File

@ -1024,11 +1024,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
* @param sender - The sender of the message
*/
private checkShouldRepositionInlineMenu(sender: chrome.runtime.MessageSender): boolean {
if (
!this.focusedFieldData ||
sender.tab.id !== this.focusedFieldData.tabId ||
!this.isFieldCurrentlyFocused
) {
if (!this.focusedFieldData || sender.tab.id !== this.focusedFieldData.tabId) {
return false;
}