Bug 1317804 - Hide the checkbox toggle in about:privatebrowsing. r?johannh draft
authorMike Conley <mconley@mozilla.com>
Sat, 19 Nov 2016 17:25:58 -0500
changeset 442073 b4475be9403de03e6ff8741b3a0a7b1e9034e910
parent 441455 f09e137ead39230eaa94f47988ccce2cfcda4195
child 537685 3f3b58b2e434f55688e8c9d946bcd3eaf2cb7df8
push id36571
push usermconley@mozilla.com
push dateMon, 21 Nov 2016 16:18:39 +0000
reviewersjohannh
bugs1317804, 1309316
milestone53.0a1
Bug 1317804 - Hide the checkbox toggle in about:privatebrowsing. r?johannh This was originally taking advantage of the fact that we were hiding HTML checkboxes by default via common.inc.css. Since bug 1309316 landed, we don't hide those checkboxes by default anymore. So now we special-case about:privatebrowsing to hide the checkbox. MozReview-Commit-ID: CaImnCPu8cE
browser/themes/shared/privatebrowsing/aboutPrivateBrowsing.css
--- a/browser/themes/shared/privatebrowsing/aboutPrivateBrowsing.css
+++ b/browser/themes/shared/privatebrowsing/aboutPrivateBrowsing.css
@@ -130,16 +130,33 @@ a.button {
   padding: 5px 40px;
   background-color: #381e59;
   border: 1px solid #43256a;
   border-radius: 4px;
   text-decoration: none;
   display: inline-block;
 }
 
+/**
+ * We want to hide the checkbox in lieu of the toggle-btn
+ * "slider toggle". We need to make the toggle keyboard
+ * focusable, however, which is not possible if it's
+ * display:none. We work around this by making the toggle
+ * invisible but still present in the display list, allowing
+ * it to receive keyboard events. When it is focused by keyboard,
+ * we use the -moz-focusring selector on the invisible checkbox
+ * to show a focus ring around the slider toggle.
+ */
+.toggle-input {
+  opacity: 0;
+  width: 0;
+  pointer-events: none;
+  position: absolute;
+}
+
 .toggle + .toggle-btn {
   box-sizing: border-box;
   cursor: pointer;
   min-width: 60px;
   height: 24px;
   border-radius: 12px;
   background-color: var(--color-grey);
   border: 1px var(--color-grey) solid;