Fixes tooltip misplacements in scrollable viewports with auto positioning

Fixes #14756.
Closes #14767.