1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 05:43:41 +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:
Jordan Aasen
2025-01-23 15:45:26 -08:00
committed by GitHub
parent dbb1639e72
commit 362745ad57
2 changed files with 3 additions and 3 deletions

View File

@@ -280,10 +280,10 @@ describe("VaultPopupAutofillService", () => {
it("should close popup after a timeout for chromium browsers", async () => {
mockPlatformUtilsService.isFirefox.mockReturnValue(false);
jest.spyOn(global, "setTimeout");
jest.spyOn(global, "requestAnimationFrame");
await service.doAutofill(mockCipher);
jest.advanceTimersByTime(50);
expect(setTimeout).toHaveBeenCalledTimes(1);
expect(requestAnimationFrame).toHaveBeenCalled();
expect(BrowserApi.closePopup).toHaveBeenCalled();
});

View File

@@ -280,7 +280,7 @@ export class VaultPopupAutofillService {
}
// 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));
}
/**