Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix bug 948057] (B2G Browser) Zooming in on modal window causes graphical issues #1729

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions media/css/base/mozilla-modal.less
Expand Up @@ -4,8 +4,8 @@

@import "../sandstone/lib.less";

body.noscroll {
overflow: hidden;
html.noscroll body {
overflow: hidden;
}

#modal {
Expand Down Expand Up @@ -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;

Expand Down
25 changes: 14 additions & 11 deletions media/js/base/mozilla-modal.js
Expand Up @@ -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';
Expand All @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down