mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00: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:
@@ -1222,13 +1222,6 @@ describe("OverlayBackground", () => {
|
|||||||
frameId: 2,
|
frameId: 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
sendMockExtensionMessage({
|
|
||||||
command: "updateIsFieldCurrentlyFocused",
|
|
||||||
isFieldCurrentlyFocused: true,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns false if the focused field data is not set", async () => {
|
it("returns false if the focused field data is not set", async () => {
|
||||||
sendMockExtensionMessage(
|
sendMockExtensionMessage(
|
||||||
{ command: "checkShouldRepositionInlineMenu" },
|
{ command: "checkShouldRepositionInlineMenu" },
|
||||||
@@ -1258,24 +1251,6 @@ describe("OverlayBackground", () => {
|
|||||||
expect(sendResponse).toHaveBeenCalledWith(false);
|
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 () => {
|
it("returns true if the focused field's frame id is equal to the sender's frame id", async () => {
|
||||||
const focusedFieldData = createFocusedFieldDataMock();
|
const focusedFieldData = createFocusedFieldDataMock();
|
||||||
sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender);
|
sendMockExtensionMessage({ command: "updateFocusedFieldData", focusedFieldData }, sender);
|
||||||
|
|||||||
@@ -1024,11 +1024,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
* @param sender - The sender of the message
|
* @param sender - The sender of the message
|
||||||
*/
|
*/
|
||||||
private checkShouldRepositionInlineMenu(sender: chrome.runtime.MessageSender): boolean {
|
private checkShouldRepositionInlineMenu(sender: chrome.runtime.MessageSender): boolean {
|
||||||
if (
|
if (!this.focusedFieldData || sender.tab.id !== this.focusedFieldData.tabId) {
|
||||||
!this.focusedFieldData ||
|
|
||||||
sender.tab.id !== this.focusedFieldData.tabId ||
|
|
||||||
!this.isFieldCurrentlyFocused
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user