Tooltip arrow not positioned correctly when offset is adjusted and placement is top or bottom
Created by: timvasil
When a tooltip/popover would appear slightly offscreen to the right or left, it's correctly shifted slightly however the arrow ends up appearing in the middle of the popover, rather than at the edge of it like it should.
In this case, getViewportAdjustedDelta
always returns {top: 0, left: 0}
because getCalculatedOffset
already made the correction to fit the tip on the page, however there are subsequent "delta.left" tests in applyPlacement
to deduce left/right vs top/bottom positioning that will break in top/bottom mode.
A fix would be to change the "delta.left" tests with a horizShift
test, where horizShift
is defined as:
var horizShift = !/right|left/.test(placement);
e.g.
var arrowPosition = horizShift ? 'left' : 'top'