mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[PM-15943] - When filling a password, the extension flickers (#12900)
* use requestAnimationFrame instead of arbitrary timeout * fix failing test
This commit is contained in:
@@ -280,10 +280,10 @@ describe("VaultPopupAutofillService", () => {
|
|||||||
|
|
||||||
it("should close popup after a timeout for chromium browsers", async () => {
|
it("should close popup after a timeout for chromium browsers", async () => {
|
||||||
mockPlatformUtilsService.isFirefox.mockReturnValue(false);
|
mockPlatformUtilsService.isFirefox.mockReturnValue(false);
|
||||||
jest.spyOn(global, "setTimeout");
|
jest.spyOn(global, "requestAnimationFrame");
|
||||||
await service.doAutofill(mockCipher);
|
await service.doAutofill(mockCipher);
|
||||||
jest.advanceTimersByTime(50);
|
jest.advanceTimersByTime(50);
|
||||||
expect(setTimeout).toHaveBeenCalledTimes(1);
|
expect(requestAnimationFrame).toHaveBeenCalled();
|
||||||
expect(BrowserApi.closePopup).toHaveBeenCalled();
|
expect(BrowserApi.closePopup).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ export class VaultPopupAutofillService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Slight delay to fix bug in Chromium browsers where popup closes without copying totp to clipboard
|
// Slight delay to fix bug in Chromium browsers where popup closes without copying totp to clipboard
|
||||||
setTimeout(() => BrowserApi.closePopup(window), 50);
|
requestAnimationFrame(() => BrowserApi.closePopup(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user