Fixes an edge case when the tooltip wouldn't move closer to the mouse cursor in some situations #3663
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This would happen in this situation:
space: the tooltip would align with the window's left edge.
go either at the right or left of the cursor. In that case we reuse the
previous position, so that the tooltip stays stable.
But if the previous position was the window-edge, then the tooltip
would stay at that location and could be far from the mouse cursor.
You can test with these links by reducing the window width a lot, or using the devtools docked at the right and increasing the devtools width to reduce the window width:
production / deploy preview
Before:
![Screencast_22-11-2021_16:09:21 webm](https://user-images.githubusercontent.com/454175/142885586-a605c387-1d18-42b2-9ad5-20cfc8f3267c.gif)
After:
![Screencast_22-11-2021_16:10:25 webm](https://user-images.githubusercontent.com/454175/142885737-79c8a21e-5fb8-40ee-8ba6-c0ad814af5ac.gif)