onDetachedMountCheck property

BoolCallback? onDetachedMountCheck
getter/setter pair

A callback that returns a bool that indicates whether the ResizeSensor was detached from the DOM when it first mounted.

Why would I need to set this callback?

If you have a ResizeSensor that is not emitting its onResize events, then the sensor was most likely mounted detached from the DOM. In that situation, the use of this callback is the recommended way to repair the resize behavior via a call to ResizeSensorComponent.forceResetDetachedSensor at a time when you are sure that the sensor has become attached to the DOM.

What does the bool argument indicate?

  • A true argument indicates that the ResizeSensor was mounted detached from the DOM, and a call to ResizeSensorComponent.forceResetDetachedSensor will be necessary to re-initialize the sensor.

    NOTE: The re-initialization comes at the expense of force-clamping the scrollLeft / scrollTop values of the expand / collapse sensor nodes to the maximum possible value - which is what forces the reflow / paint that makes the onResize callbacks begin firing when expected again.

  • A false argument indicates that the ResizeSensor was mounted attached to the DOM.

    NOTE: If this happens - you most likely do not need to set this callback. If for some reason the callback sometimes returns true, and sometimes returns false (unexpected), you may have other underlying issues in your implementation that should be addressed separately.

Implementation

BoolCallback? onDetachedMountCheck;