Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getAnchoredPosition returns position without perfectly aligned edges #63

Closed
khiga8 opened this issue Feb 28, 2022 · 3 comments · Fixed by #78 or primer/view_components#1130
Closed
Assignees
Labels
behaviors bug Something isn't working react

Comments

@khiga8
Copy link

khiga8 commented Feb 28, 2022

Context

We use getAnchoredPosition for primer-tooltip positioning (which is soon to be upstreamed to PVC).

In some scenarios, we observed the tooltip is not perfectly aligned at edge, particularly when there's no space for perfect edge alignment. Here is an example where align is end.

Screenshot of tooltip edge not perfectly aligned at edge of anchor element

I was also able to recreate this issue in storybook:

Screenshot of storybook example where floating element edge is not perfectly aligned at edge of anchor element

Expected behavior

Since there’s no space to perfectly align end, I would have expected anchorAlignment to be adjusted to start instead. Is that not expected behavior?

For now, we're thinking of housing additional positioning logic in tooltip to address immediate issues, but this should probably be responsibility of getAnchoredPosition.

@siddharthkp siddharthkp added bug Something isn't working react labels Mar 1, 2022
@siddharthkp
Copy link
Member

Thanks Kate! Added this to the primer-react board to prioritise it!

@khiga8
Copy link
Author

khiga8 commented Mar 1, 2022

Yay @siddharthkp! Will you let me know once this has been worked on so I can remove the extra logic from tooltip code? Thank you ☺️

@siddharthkp
Copy link
Member

Fix released in primer/behaviors@1.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behaviors bug Something isn't working react
Projects
None yet
3 participants