1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-26 01:23:24 +00:00

Autofill/pm 21864 center unlock vault modal (#14867)

* Center the Locked Vault modal when using passkeys

* Revert swift changes and handle offscreen modals

* Remove comments
This commit is contained in:
Jeffrey Holland
2025-06-02 18:31:34 +02:00
committed by GitHub
parent 10ae123cb2
commit 0376ead84e
2 changed files with 25 additions and 4 deletions

View File

@@ -265,6 +265,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
): Promise<void> {
// Load the UI:
await this.desktopSettingsService.setModalMode(true, showTrafficButtons, position);
await this.centerOffscreenPopup();
await this.router.navigate([
route,
{
@@ -341,7 +342,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
const status = await firstValueFrom(this.authService.activeAccountStatus$);
if (status !== AuthenticationStatus.Unlocked) {
await this.showUi("/lock", this.windowObject.windowXy, true, true);
await this.showUi("/lock", undefined, true, true);
let status2: AuthenticationStatus;
try {
@@ -370,4 +371,25 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
async close() {
this.logService.warning("close");
}
private async centerOffscreenPopup() {
if (!this.windowObject.windowXy) {
return;
}
const popupWidth = 600;
const popupHeight = 600;
const window = await firstValueFrom(this.desktopSettingsService.window$);
const { width, height } = window.displayBounds;
const { x, y } = this.windowObject.windowXy;
if (x < popupWidth || x > width - popupWidth || y < popupHeight || y > height - popupHeight) {
const popupHeightOffset = 300;
const { width, height } = window.displayBounds;
const centeredX = width / 2;
const centeredY = (height - popupHeightOffset) / 2;
this.windowObject.windowXy = { x: centeredX, y: centeredY };
}
}
}