From 2449534e9edbc775931169ee1e9ba0c867708d24 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Wed, 22 Sep 2021 07:36:28 +1000 Subject: [PATCH] Fix totp copy not working in Chrome (#2067) * Fix totp copy not working in Chrome * Only use fix for Chromium-based browsers --- src/popup/vault/current-tab.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/popup/vault/current-tab.component.ts b/src/popup/vault/current-tab.component.ts index 30de05f190..be869ec01c 100644 --- a/src/popup/vault/current-tab.component.ts +++ b/src/popup/vault/current-tab.component.ts @@ -156,7 +156,12 @@ export class CurrentTabComponent implements OnInit, OnDestroy { this.platformUtilsService.copyToClipboard(this.totpCode, { window: window }); } if (this.popupUtilsService.inPopup(window)) { - BrowserApi.closePopup(window); + if (this.platformUtilsService.isFirefox() || this.platformUtilsService.isSafari()) { + BrowserApi.closePopup(window); + } else { + // Slight delay to fix bug in Chromium browsers where popup closes without copying totp to clipboard + setTimeout(() => BrowserApi.closePopup(window), 50); + } } } catch { this.ngZone.run(() => {