From 7e78b2830b68572701eda3ccac734810653f8081 Mon Sep 17 00:00:00 2001
From: Shane Tomlinson <stomlinson@mozilla.com>
Date: Fri, 11 May 2012 11:23:04 +0100
Subject: [PATCH] Fix for Chrome shifting the "Sign In" button in the email
 picker when clicking.

issue #1581
---
 resources/static/dialog/css/popup.css                | 10 ++++++++++
 .../static/dialog/resources/screen_size_hacks.js     | 12 ++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/resources/static/dialog/css/popup.css b/resources/static/dialog/css/popup.css
index 4d456ea67..d8f0f3d10 100644
--- a/resources/static/dialog/css/popup.css
+++ b/resources/static/dialog/css/popup.css
@@ -302,6 +302,16 @@ div#required_email {
 #selectEmail.center {
     position: static;
     overflow-y: visible;
+    /* The below 1px padding is part of a fix for a bug in webkit where there
+     * is a ghost padding-right to accommodate the scroll bar that is shown
+     * if there are many email addresses. The ghost padding caused the submit
+     * button to shift when the user clicked on it, sometimes making the
+     * submit button require two clicks.  The other half of the fix is in
+     * screen_size_hacks.js, where an adjustment to the width is made.
+     * These two in combination force Chrome to re-flow, which fixes its
+     * own bug.
+     */
+    padding-right: 1px;
 }
 
 .inputs {
diff --git a/resources/static/dialog/resources/screen_size_hacks.js b/resources/static/dialog/resources/screen_size_hacks.js
index 0d48fa3d9..66b14865f 100644
--- a/resources/static/dialog/resources/screen_size_hacks.js
+++ b/resources/static/dialog/resources/screen_size_hacks.js
@@ -30,6 +30,18 @@
 
       if(height < $("#signIn .vertical").innerHeight()) {
         selectEmailEl.addClass("center");
+
+        /* The below width adjustment is part of a fix for a bug in webkit where
+         * there is a ghost padding-right to accommodate the scroll bar that is
+         * shown if there are many email addresses. The ghost padding caused the
+         * submit button to shift when the user clicked on it, sometimes making
+         * the submit button require two clicks.  The other half of the fix is
+         * in popup.css, where an adjustment to the padding is made.
+         * These two in combination force Chrome to re-flow, which fixes its
+         * own bug.
+         */
+        var width = selectEmailEl.width();
+        selectEmailEl.width(width);
       }
       else {
         selectEmailEl.removeClass("center");
-- 
GitLab