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:
parent
c69a82a304
commit
b1e75ad7b5
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user