microsoft-authentication-library-for-js
microsoft-authentication-library-for-js copied to clipboard
msal-browser popup position for dual screen
Core Library
MSAL.js v2 (@azure/msal-browser)
Wrapper Library
Not Applicable
Description
Hello,
For dual screen setup, Popup cannot be positioned with negative values which occures depending of which screen is defined as the main one.
Setup example:

In both of those case the top or left variable will need negative values to position popup at the center of the screen, but negative values are ignored by openSizedPopup function in lib/msal-browser/src/utils/PopupUtils.ts, here is the snippet involved:
if (!top || top < 0 || top > winHeight) {
logger.verbose("Default popup window top position used. Window top not configured or invalid.");
top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);
}
if (!left || left < 0 || left > winWidth) {
logger.verbose("Default popup window left position used. Window left not configured or invalid.");
left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);
}
I makes it impossible for the application to position the popup at will using the popupWindowAttributes.popupPosition attribute, resulting the popup to be automatically positioned to the 0 axis depending of the screen setup.
Are there reasons I am unaware of to restrict negative values for popup positioning?
Thank you
Source
External (Customer)
@waxisien could you provide a screenshot showing where you want the popup to appear so we can better understand the request? Thanks.
Case 1: when the bottom screen is the main display, the popup is not centered but aligned with the bottom border:

Case 2: when the top screen is the main display, the popup is centered as it should be:

The same behavior can be observed when screen are displayed horizontally.
Please note that in those examples the popup is automatically positioned by msal, but the first case doesn't work either when I set manually the popup position using the popupWindowAttributes param.
Thanks
@jo-arroyo can you check if this is addressed already?
Hi!
Im also experience this issue. Are there any known workarounds or any plan to fix the issue?