Bug 1532701 - Disabled checkboxes should not accept label@control being clicked to toggle their checked state. r=Gijs
authorJared Wein <jwein@mozilla.com>
Tue, 16 Apr 2019 21:55:48 +0000
changeset 469799 c4bdde9df111
parent 469798 a72c4fef3a4a
child 469800 502d08723c19
push id35882
push usercbrindusan@mozilla.com
push dateWed, 17 Apr 2019 15:54:01 +0000
treeherdermozilla-central@37185c0ae520 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1532701
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1532701 - Disabled checkboxes should not accept label@control being clicked to toggle their checked state. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D27825
toolkit/content/widgets/text.xml
--- a/toolkit/content/widgets/text.xml
+++ b/toolkit/content/widgets/text.xml
@@ -219,16 +219,21 @@
           return;
         }
         controlElement.focus();
         const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
         if (controlElement.namespaceURI != XUL_NS) {
           return;
         }
+        if ((controlElement.localName == "checkbox" ||
+             controlElement.localName == "radio") &&
+            controlElement.getAttribute("disabled") == "true") {
+          return;
+        }
         if (controlElement.localName == "checkbox") {
           controlElement.checked = !controlElement.checked;
         } else if (controlElement.localName == "radio") {
           controlElement.control.selectedItem = controlElement;
         }
       ]]></handler>
     </handlers>
   </binding>