Skip to content

Commit

Permalink
Wrap entire top and left popup position calculations with Math.max in…
Browse files Browse the repository at this point in the history
…stead of just wrapping the offset
  • Loading branch information
hectormmg committed Jul 16, 2020
1 parent 1708874 commit b4abe08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/msal-browser/src/interaction_handler/PopupHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export class PopupHandler extends InteractionHandler {
*/
const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
const height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
const left = ((width / 2) - (popUpWidth / 2)) + Math.max(0, winLeft);
const top = ((height / 2) - (popUpHeight / 2)) + Math.max(0, winTop);
const left = Math.max(0, ((width / 2) - (popUpWidth / 2)) + winLeft);
const top = Math.max(0, ((height / 2) - (popUpHeight / 2)) + winTop);

// open the window
const popupWindow = window.open(urlNavigate, title, "width=" + popUpWidth + ", height=" + popUpHeight + ", top=" + top + ", left=" + left);
Expand Down

0 comments on commit b4abe08

Please sign in to comment.