]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Properly hide checkbox and radio inputs in button groups 14559/head
authorHeinrich Fenkart <hnrch02@gmail.com>
Sun, 7 Sep 2014 20:45:54 +0000 (22:45 +0200)
committerHeinrich Fenkart <hnrch02@gmail.com>
Mon, 8 Sep 2014 12:56:29 +0000 (14:56 +0200)
`pointer-events: none;` for modern browsers (including IE11+), `clip: rect(1px, 1px, 1px, 1px);` for everything else.

Fixes #14137

less/button-groups.less

index c2e2260f066ff59af676ec9b69a9c9bab71cd8fc..6092afcd6ee6176db044583d3087313c8838148a 100644 (file)
 // Checkbox and radio options
 //
 // In order to support the browser's form validation feedback, powered by the
-// `required` attribute, we have to "hide" the inputs via `opacity`. We cannot
-// use `display: none;` or `visibility: hidden;` as that also hides the popover.
+// `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
+// `display: none;` or `visibility: hidden;` as that also hides the popover.
+// Simply visually hiding the inputs via `opacity` would leave them clickable in
+// certain cases which is prevented by using `clip` and `pointer-events`.
 // This way, we ensure a DOM element is visible to position the popover from.
 //
-// See https://github.com/twbs/bootstrap/pull/12794 for more.
+// See https://github.com/twbs/bootstrap/pull/12794 and
+// https://github.com/twbs/bootstrap/pull/14559 for more information.
 
 [data-toggle="buttons"] {
   > .btn,
     input[type="radio"],
     input[type="checkbox"] {
       position: absolute;
-      z-index: -1;
-      .opacity(0);
+      clip: rect(0,0,0,0);
+      pointer-events: none;
     }
   }
 }