From 4d7209b35305130c1acf45fcab61a140a52a7801 Mon Sep 17 00:00:00 2001 From: Shane Tomlinson <stomlinson@mozilla.com> Date: Mon, 25 Jun 2012 09:50:21 +0100 Subject: [PATCH] Trigger a window resize DOM event when new content is displayed or when screens are shown/hidden. * This ensures the center area is always centered and the scroll bar is shown when necessary. --- resources/static/dialog/controllers/actions.js | 1 - resources/static/shared/error-display.js | 7 ++++++- resources/static/shared/screens.js | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/static/dialog/controllers/actions.js b/resources/static/dialog/controllers/actions.js index 80435e522..3a95c8915 100644 --- a/resources/static/dialog/controllers/actions.js +++ b/resources/static/dialog/controllers/actions.js @@ -28,7 +28,6 @@ BrowserID.Modules.Actions = (function() { } mediator.publish("service", { name: name }); - bid.resize(); return module; } diff --git a/resources/static/shared/error-display.js b/resources/static/shared/error-display.js index c607eac8f..7777364d2 100644 --- a/resources/static/shared/error-display.js +++ b/resources/static/shared/error-display.js @@ -14,7 +14,12 @@ BrowserID.ErrorDisplay = (function() { /** * XXX What a big steaming pile, use CSS animations for this! */ - $("#moreInfo").slideDown(); + $("#moreInfo").slideDown(function() { + // The expanded info may be partially obscured on mobile devices in + // landscape mode. Force the screen size hacks to account for the new + // expanded size. + dom.fireEvent(window, "resize"); + }); $("#openMoreInfo").css({visibility: "hidden"}); } diff --git a/resources/static/shared/screens.js b/resources/static/shared/screens.js index 0ce5cd133..e45daaea6 100644 --- a/resources/static/shared/screens.js +++ b/resources/static/shared/screens.js @@ -15,11 +15,13 @@ BrowserID.Screens = (function() { show: function(template, vars) { renderer.render(target + " .contents", template, vars); dom.addClass(BODY, className); + dom.fireEvent(window, "resize"); this.visible = true; }, hide: function() { dom.removeClass(BODY, className); + dom.fireEvent(window, "resize"); this.visible = false; } } -- GitLab