You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an element is being hidden from the DOM, a trigger("hidden") javacript call needs to be made on that element, to notify shiny to not render it anymore. The classic way to hide an element is using the .hide() method. However, it seems like elements that are being hidden using animation javascript do not properly get hidden in the reactive graph. Example:
In this code, an element is being hidden using jquery's fadeOut(). You can see that despite triggering the hidden event, the output still gets rendered. A similar thing happens when using slideUp() instead of fadeOut().
It seems that if you make the animation very fast, for example using fadeOut(5) (5 milliseconds), then the trigger does hold.
I noticed that if I add a callback function to the animation fadeOut(500, function() { $(this).trigger('hidden'); }) then it does work correctly. Because of this, my theory is that when hidden is triggered, shiny looks at the element, and only acts if the element has display:none.
The text was updated successfully, but these errors were encountered:
I'm pretty sure #3682 (using ResizeObserver()/IntersectionObserver()/MutationObserver() to detect changes in size/visibility) would solve this (as well as a whole other set of issues)
Originally reported in daattali/shinyjs#266
When an element is being hidden from the DOM, a
trigger("hidden")
javacript call needs to be made on that element, to notify shiny to not render it anymore. The classic way to hide an element is using the.hide()
method. However, it seems like elements that are being hidden using animation javascript do not properly get hidden in the reactive graph. Example:In this code, an element is being hidden using jquery's
fadeOut()
. You can see that despite triggering thehidden
event, the output still gets rendered. A similar thing happens when usingslideUp()
instead offadeOut()
.It seems that if you make the animation very fast, for example using
fadeOut(5)
(5 milliseconds), then the trigger does hold.I noticed that if I add a callback function to the animation
fadeOut(500, function() { $(this).trigger('hidden'); })
then it does work correctly. Because of this, my theory is that whenhidden
is triggered, shiny looks at the element, and only acts if the element hasdisplay:none
.The text was updated successfully, but these errors were encountered: