Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix bug 948057] (B2G Browser) Zooming in on modal window causes grap…

…hical issues
  • Loading branch information...
commit 45fd17e546cb94a44681ed7b0c84c08f9ffceaac 1 parent d74bee6
@alexgibson alexgibson authored
Showing with 28 additions and 13 deletions.
  1. +14 −2 media/css/base/mozilla-modal.less
  2. +14 −11 media/js/base/mozilla-modal.js
View
16 media/css/base/mozilla-modal.less
@@ -4,8 +4,8 @@
@import "../sandstone/lib.less";
-body.noscroll {
- overflow: hidden;
+html.noscroll body {
+ overflow: hidden;
}
#modal {
@@ -121,6 +121,18 @@ html[dir="rtl"] {
}
@media only screen and (max-width: @breakTablet) {
+ html.noscroll {
+ overflow: hidden;
+ height: 100%;
+ body {
+ height: 100%;
+ overflow: hidden;
+ }
+ #modal {
+ position: absolute;
+ }
+ }
+
#modal .window {
margin: 0 auto;
View
25 media/js/base/mozilla-modal.js
@@ -9,6 +9,7 @@ Mozilla.Modal = (function(w, $) {
var open = false;
var $modal = null;
var $body = $('body');
+ var $html = $('html');
var options = {};
var $d = $(w.document);
var evtNamespace = 'moz-modal';
@@ -30,6 +31,8 @@ Mozilla.Modal = (function(w, $) {
var _createModal = function(origin, content, opts) {
options = opts;
+ var isSmallViewport = $(w).width() < 760;
+
// Make sure modal is closed (if one exists)
if (open) {
_closeModal();
@@ -51,15 +54,15 @@ Mozilla.Modal = (function(w, $) {
' </div>' +
'</div>');
- // Add modal to page
- $body.append($modal);
-
- if (options && !options.allowScroll) {
- $body.addClass('noscroll');
+ if ((options && !options.allowScroll) || isSmallViewport) {
+ $html.addClass('noscroll');
} else {
- $body.removeClass('noscroll');
+ $html.removeClass('noscroll');
}
+ // Add modal to page
+ $body.append($modal);
+
$_content = content;
$_contentParent = $_content.parent();
$('#modal .inner').append($_content);
@@ -115,13 +118,13 @@ Mozilla.Modal = (function(w, $) {
$('#modal').fadeOut('fast', function() {
$_contentParent.append($_content);
$(this).remove();
- });
- // allow page to scroll again
- $body.removeClass('noscroll');
+ // allow page to scroll again
+ $html.removeClass('noscroll');
- // restore focus to element that opened the modal
- $('.modal-origin').focus().removeClass('modal-origin');
+ // restore focus to element that opened the modal
+ $('.modal-origin').focus().removeClass('modal-origin');
+ });
open = false;
$modal = null;
Please sign in to comment.
Something went wrong with that request. Please try again.