ModalWindow size may exceed browser viewport making it impossible to close
--------------------------------------------------------------------------
Key: WICKET-2254
URL: https://issues.apache.org/jira/browse/WICKET-2254
Project: Wicket
Issue Type: Bug
Components: wicket-extensions
Affects Versions: 1.3.6
Reporter: Per Cederberg
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) {
+ this.window.style.width = (width - 10) + "px";
+ modalWidth = this.window.offsetWidth;
+ }
+ 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.