mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
[EC-598] feat: center popup
This commit is contained in:
@@ -42,7 +42,7 @@ export class PopupUtilsService {
|
||||
}
|
||||
}
|
||||
|
||||
popOut(win: Window, href: string = null): void {
|
||||
popOut(win: Window, href: string = null, options: { center?: boolean } = {}): void {
|
||||
if (href === null) {
|
||||
href = win.location.href;
|
||||
}
|
||||
@@ -60,11 +60,17 @@ export class PopupUtilsService {
|
||||
}
|
||||
|
||||
const bodyRect = document.querySelector("body").getBoundingClientRect();
|
||||
const width = Math.round(bodyRect.width ? bodyRect.width + 60 : 375);
|
||||
const height = Math.round(bodyRect.height || 600);
|
||||
const top = options.center ? Math.round((screen.height - height) / 2) : undefined;
|
||||
const left = options.center ? Math.round((screen.width - width) / 2) : undefined;
|
||||
chrome.windows.create({
|
||||
url: href,
|
||||
type: "popup",
|
||||
width: Math.round(bodyRect.width ? bodyRect.width + 60 : 375),
|
||||
height: Math.round(bodyRect.height || 600),
|
||||
width,
|
||||
height,
|
||||
top,
|
||||
left,
|
||||
});
|
||||
|
||||
if (win && this.inPopup(win)) {
|
||||
|
||||
@@ -44,7 +44,11 @@ export class BrowserFido2UserInterfaceService implements Fido2UserInterfaceServi
|
||||
const requestId = Utils.newGuid();
|
||||
const data: BrowserFido2Message = { type: "VerifyUserRequest", requestId };
|
||||
const queryParams = new URLSearchParams(data).toString();
|
||||
this.popupUtilsService.popOut(null, `popup/index.html?uilocation=popout#/fido2?${queryParams}`);
|
||||
this.popupUtilsService.popOut(
|
||||
null,
|
||||
`popup/index.html?uilocation=popout#/fido2?${queryParams}`,
|
||||
{ center: true }
|
||||
);
|
||||
|
||||
const response = await lastValueFrom(
|
||||
this.messages$.pipe(
|
||||
|
||||
Reference in New Issue
Block a user