Closed james-carrots closed 3 years ago
When this.calculatePosition happens the first time, because we are using scrollWidth, the offset doesn't get calculate properly. The tooltip pops open to the right, and creates more space to the right, and auto scrolls there. (or it may not, depending on OS setting)
*note: the orange blocks are intentionally hardcoded to visualize where the target dom for clicking is
Afterwards, when scrollWidth becomes correct, this doesn't happen again. With the wrong scrollWidth, the calculation if block doesn't get triggered.
else if (overlayDistanceFromRightEdge > documentWidth) { https://github.com/instacart/Snacks/blob/master/src/components/Tooltip/TooltipPosition.js#L89
So far in debugging offsetWidth has been the correct width to use to trigger things
proposing to change to offsetWidth