Fixed XF.ToggleClick does not trigger toggle:shown on the right context

TickTackk

Well-known member
Affected version
2.2.2
When hidden it correctly triggers:
JavaScript:
            if (this.$toggleParent)
            {
                this.$toggleParent.addClassTransitioned(activeClass, this.activeTransitionComplete, instant);
            }
            if (this.$toggleTarget)
            {
                this.$toggleTarget.addClassTransitioned(activeClass, this.activeTransitionComplete, instant);
            }
            this.$target.addClassTransitioned(activeClass, this.activeTransitionComplete, instant);
but when shown it doesn't:
JavaScript:
            if (this.$toggleParent)
            {
                this.$toggleParent.removeClassTransitioned(activeClass, XF.proxy(this, 'inactiveTransitionComplete'), instant);
            }
            if (this.$toggleTarget)
            {
                this.$toggleTarget.removeClassTransitioned(activeClass, XF.proxy(this, 'inactiveTransitionComplete'), instant);
            }
            this.$target.removeClassTransitioned(activeClass, XF.proxy(this, 'inactiveTransitionComplete'), instant);
Note the XF.proxy(blah) call.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.4).

Change log:
Ensure toggle:hidden event is triggered correctly when hiding toggle elements.
There may be a delay before changes are rolled out to the XenForo Community.
 
The report is slightly confusing as I think you have the code samples the wrong way round. I believe it was working for show but not working for hide.

I've included a .diff below, please speak up if these changes don't work as you expect:

Diff:
Index: js/xf/core/structure.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/xf/core/structure.js b/js/xf/core/structure.js
--- a/js/xf/core/structure.js    (revision Staged)
+++ b/js/xf/core/structure.js    (date 1614595667835)
@@ -1668,13 +1668,13 @@
 
             if (this.$toggleParent)
             {
-                this.$toggleParent.removeClassTransitioned(activeClass, XF.proxy(this, 'inactiveTransitionComplete'), instant);
+                this.$toggleParent.removeClassTransitioned(activeClass, this.inactiveTransitionComplete, instant);
             }
             if (this.$toggleTarget)
             {
-                this.$toggleTarget.removeClassTransitioned(activeClass, XF.proxy(this, 'inactiveTransitionComplete'), instant);
+                this.$toggleTarget.removeClassTransitioned(activeClass, this.inactiveTransitionComplete, instant);
             }
-            this.$target.removeClassTransitioned(activeClass, XF.proxy(this, 'inactiveTransitionComplete'), instant);
+            this.$target.removeClassTransitioned(activeClass, this.inactiveTransitionComplete, instant);
         },
 
         show: function(instant)
 
Back
Top Bottom