Bug 973217 - Australis' bookmarks menu shouldn't allow for mouse events during the transition (transition event handler variant), r=jaws
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 24 Feb 2014 17:44:42 +0000
changeset 170840 706f36fe921f078104504dcbd7731486736846ba
parent 170839 6a8b0834c5fc4c85ecf268af43a2a11200acced5
child 170841 efa293b9889326903c65166569a788565c2a4d77
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersjaws
bugs973217
milestone30.0a1
Bug 973217 - Australis' bookmarks menu shouldn't allow for mouse events during the transition (transition event handler variant), r=jaws
browser/components/places/content/menu.xml
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -573,15 +573,31 @@
     </implementation>
 
     <handlers>
       <handler event="popupshowing" phase="target"><![CDATA[
         this.adjustArrowPosition();
       ]]></handler>
       <handler event="popupshown" phase="target"><![CDATA[
         this.setAttribute("panelopen", "true");
+        //XXXgijs: this is sadfaces, reading styles right after we dirty layout, but
+        //I don't know of a way around it.
+        let container = document.getAnonymousElementByAttribute(this, "anonid", "container");
+        let cs = getComputedStyle(container);
+        let transitionProp = cs.transitionProperty;
+        let transitionTime = parseFloat(cs.transitionDuration);
+        if ((transitionProp.indexOf("transform") > -1 || transitionProp == "all") &&
+            transitionTime > 0) {
+          this.style.pointerEvents = 'none';
+        }
+      ]]></handler>
+      <handler event="transitionend"><![CDATA[
+        if (event.originalTarget.getAttribute("anonid") == "container" &&
+            event.propertyName == "transform") {
+          this.style.removeProperty("pointer-events");
+        }
       ]]></handler>
       <handler event="popuphidden" phase="target"><![CDATA[
         this.removeAttribute("panelopen");
       ]]></handler>
     </handlers>
   </binding>
 </bindings>