Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.3.6
-
None
Description
If a modal window is created with a size that is larger than what is available in the browser viewport, the user will be unable to close the window. The close button is displayed over the top of the window, making it impossible to reach.
The problem lies in the center() function inside modal.js and is easy enough to fix:
+ // BUGFIX: Adjust the width and height to maximum values
+ if (modalWidth > width - 10)
+ if (modalHeight > height - 40)
{ + this.content.style.height = (height - 40) + "px"; + modalHeight = this.window.offsetHeight; + } var left = (width / 2) - (modalWidth / 2) + scLeft;
var top = (height / 2) - (modalHeight / 2) + scTop;
+ // BUGFIX: Ensure positive position values
+ this.window.style.left = Math.max(left, 0) + "px";
+ this.window.style.top = Math.max(top, 0) + "px";
Note that the above code also ensures that the window position is positive at all times.