1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-21 16:18:28 +01:00

[PM-14054] Fixing scroll-based repositioning of inline menu when inline menu is focused (#11770)

This commit is contained in:
Cesar Gonzalez 2024-10-29 16:55:40 -05:00 committed by GitHub
parent d50e8bbf4c
commit 896d19551a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import AutofillInit from "./autofill-init";
domQueryService,
domElementVisibilityService,
inlineMenuFieldQualificationService,
inlineMenuContentService,
);
windowContext.bitwardenAutofillInit = new AutofillInit(

View File

@ -24,6 +24,7 @@ import AutofillInit from "./autofill-init";
domQueryService,
domElementVisibilityService,
inlineMenuFieldQualificationService,
inlineMenuContentService,
);
windowContext.bitwardenAutofillInit = new AutofillInit(

View File

@ -1,4 +1,4 @@
import { mock } from "jest-mock-extended";
import { mock, MockProxy } from "jest-mock-extended";
import { EVENTS } from "@bitwarden/common/autofill/constants";
import { CipherType } from "@bitwarden/common/vault/enums";
@ -13,6 +13,7 @@ import {
import AutofillField from "../models/autofill-field";
import AutofillForm from "../models/autofill-form";
import AutofillPageDetails from "../models/autofill-page-details";
import { AutofillInlineMenuContentService } from "../overlay/inline-menu/abstractions/autofill-inline-menu-content.service";
import { createAutofillFieldMock } from "../spec/autofill-mocks";
import {
flushPromises,
@ -35,6 +36,7 @@ describe("AutofillOverlayContentService", () => {
let domElementVisibilityService: DomElementVisibilityService;
let autofillInit: AutofillInit;
let inlineMenuFieldQualificationService: InlineMenuFieldQualificationService;
let inlineMenuContentService: MockProxy<AutofillInlineMenuContentService>;
let autofillOverlayContentService: AutofillOverlayContentService;
let sendExtensionMessageSpy: jest.SpyInstance;
const sendResponseSpy = jest.fn();
@ -44,10 +46,12 @@ describe("AutofillOverlayContentService", () => {
inlineMenuFieldQualificationService = new InlineMenuFieldQualificationService();
domQueryService = new DomQueryService();
domElementVisibilityService = new DomElementVisibilityService();
inlineMenuContentService = mock<AutofillInlineMenuContentService>();
autofillOverlayContentService = new AutofillOverlayContentService(
domQueryService,
domElementVisibilityService,
inlineMenuFieldQualificationService,
inlineMenuContentService,
);
autofillInit = new AutofillInit(
domQueryService,

View File

@ -28,6 +28,7 @@ import {
} from "../enums/autofill-overlay.enum";
import AutofillField from "../models/autofill-field";
import AutofillPageDetails from "../models/autofill-page-details";
import { AutofillInlineMenuContentService } from "../overlay/inline-menu/abstractions/autofill-inline-menu-content.service";
import { ElementWithOpId, FillableFormFieldElement, FormFieldElement } from "../types";
import {
currentlyInSandboxedIframe,
@ -155,6 +156,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
private domQueryService: DomQueryService,
private domElementVisibilityService: DomElementVisibilityService,
private inlineMenuFieldQualificationService: InlineMenuFieldQualificationService,
private inlineMenuContentService?: AutofillInlineMenuContentService,
) {}
/**
@ -1580,7 +1582,8 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ
if (activeElement) {
return (
activeElement === this.mostRecentlyFocusedField ||
activeElement.contains(this.mostRecentlyFocusedField)
activeElement.contains(this.mostRecentlyFocusedField) ||
this.inlineMenuContentService?.isElementInlineMenu(activeElement as HTMLElement)
);
}