If this only applies to hover tooltips, I’d be okay with making it the only behavior for hover tooltips. We could make
above act like a hint (i.e. ignore
strictSide) and, when grouping, just take the side of the first tooltip. That would keep the types from getting too complicated.
As for the DOM structure, I think if we document the fact hover tooltips nest inside an additional element, we’re fine. Not sure what to do by default for borders between the elements. I guess the base theme could assign a simple border like in your screenshot.
Regarding the code, I think the tooltip-managing logic (as in
updateTooltip) would best be expressed as a class, so that we don’t have to push 6 input parameters and 4 return values back and forth like that.