fix: popup position for point-aligned popups when no mouse position is known #447
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.
When setting
popupVisible
of a<Trigger />
to true in a controlled manner, the popup is shown at 0,0 of the current page instead of being placed around its actual target. The reason for this is that the mouse position is initialized to 0, 0 and then passed along touseAlign
.This is a regression that was introduced in 848a197. In 7590937 this used to work and it had the exact logic I now re-added.
Within 848a197, the missing null initialization was introduced here:
848a197#diff-0b5adbfe7b36e4ae2f479291e20152e33e940f7f265162d77f40f6bdb5da7405R310
And here's the conditional passing of the point that was removed: 848a197#diff-0b5adbfe7b36e4ae2f479291e20152e33e940f7f265162d77f40f6bdb5da7405L542
As a test, I set
popupVisible
to true in rc-trigger/docs/examples/point.tsx so that the popup is rendered by default.Before:
After:
Would fix ant-design/ant-design#47152.