microsoft-authentication-library-for-js icon indicating copy to clipboard operation
microsoft-authentication-library-for-js copied to clipboard

msal-browser popup position for dual screen

Open waxisien opened this issue 3 years ago • 5 comments
trafficstars

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: Screen Shot 2022-02-16 at 9 11 17 AM Screen Shot 2022-02-16 at 9 10 47 AM

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 avatar Feb 16 '22 14:02 waxisien

@waxisien could you provide a screenshot showing where you want the popup to appear so we can better understand the request? Thanks.

hectormmg avatar Feb 17 '22 21:02 hectormmg

Case 1: when the bottom screen is the main display, the popup is not centered but aligned with the bottom border: Popup_non_main_screen

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

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

waxisien avatar Feb 18 '22 22:02 waxisien

@jo-arroyo can you check if this is addressed already?

sameerag avatar Apr 13 '22 23:04 sameerag

Hi!

Im also experience this issue. Are there any known workarounds or any plan to fix the issue?

Ralf-ola avatar Aug 18 '23 08:08 Ralf-ola