instacart / Snacks

The Instacart Component Library
https://instacart.github.io/Snacks/
Apache License 2.0
81 stars 36 forks source link

0.0.158 #466

Closed james-carrots closed 3 years ago

james-carrots commented 3 years ago

Introducing a new prop delayCalculatePosition to Tooltip that propagates to TooltipOverlay > TooltipPosition. A client must pass in delayCalculatePosition={true} when consuming the Tooltip react component.

When delayCalculatePosition is set to true, TooltipPosition will wait 300ms before doing the calculation of tooltip offsets. This delay is necessary for cases when the overlays are not set and final, and prevents expensive and buggy recalculation as opposed to getting it right the first time.

Note: This also reverts 0.0.157's change of using offsetWidth instead of scrollWidth. 0.0.158 will use scrollWidth.

so this.calculatePosition() is reverted to be the same as versions prior to 0.0.157

https://github.com/instacart/Snacks/pull/465/files