Bug 1378313 - Fix up bogus code showing the reload button as enabled when it's disabled. r?johannh draft
authorDão Gottwald <dao@mozilla.com>
Wed, 05 Jul 2017 11:14:20 +0200
changeset 604113 6596959e491f208bb848ebe0bd9afdb77ada9bc5
parent 603741 5bed7af5695125fa7aca66239fe15698e0fd4a3c
child 636086 1ffb7481cb0b132820a78985ac24d0f015a82d6d
push id66956
push userdgottwald@mozilla.com
push dateWed, 05 Jul 2017 09:15:01 +0000
reviewersjohannh
bugs1378313, 1376893
milestone56.0a1
Bug 1378313 - Fix up bogus code showing the reload button as enabled when it's disabled. r?johannh Bug 1376893's approach is wrong in various ways: - It shows the reload button as enabled for about:blank - The disabled state styling is implemented in browser/themes/shared/toolbarbuttons.inc.css, and could be implemented differently. browser/base/content/browser.css should not depend on theme specifics. - :not(:-moz-window-inactive) only begins to make sense on Mac, and obviously prevents the fix from taking effect in inactive windows MozReview-Commit-ID: A5yX9dc4TOK
browser/base/content/browser.css
browser/base/content/browser.js
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -469,22 +469,20 @@ toolbar:not(#TabsToolbar) > #personal-bo
   display: -moz-box;
 }
 
 #reload-button:not([displaystop]) + #stop-button,
 #reload-button[displaystop] {
   visibility: collapse;
 }
 
-/* The reload-button is only disabled temporarily when it becomes visible
-   to prevent users from accidentally clicking it. We don't however need
-   to show this disabled state, as the flicker that it generates is short
-   enough to be visible but not long enough to explain anything to users. */
-#reload-button[disabled]:not(:-moz-window-inactive) > .toolbarbutton-icon {
-  opacity: 1 !important;
+/* Temporarily disable the reload button to prevent the user from
+   accidentally reloading the page when intending to click the stop button. */
+#reload-button[temporarily-disabled] {
+  pointer-events: none;
 }
 
 #PanelUI-feeds > .feed-toolbarbutton:-moz-locale-dir(rtl) {
   direction: rtl;
 }
 
 #panelMenu_bookmarksMenu > .bookmark-item {
   max-width: none;
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4963,21 +4963,20 @@ var CombinedStopReload = {
       return;
     }
 
     if (this._timer)
       return;
 
     // Temporarily disable the reload button to prevent the user from
     // accidentally reloading the page when intending to click the stop button
-    this.reload.disabled = true;
+    this.reload.setAttribute("temporarily-disabled", "true");
     this._timer = setTimeout(function(self) {
       self._timer = 0;
-      self.reload.disabled = XULBrowserWindow.reloadCommand
-                                             .getAttribute("disabled") == "true";
+      self.reload.removeAttribute("temporarily-disabled");
     }, 650, this);
   },
 
   _cancelTransition() {
     if (this._timer) {
       clearTimeout(this._timer);
       this._timer = 0;
     }