You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I noticed that the tooltips in PR pages are not aligned properly when body has margin set.
Check out the comparison below, you can see the tooltip shifts 200px relative to body between the 2 cases. And 200px is exactly the margin-left set to body.
no margin on body
Manually add 200px margin on body
Why would body has margin?
I noticed this issue because I use a GitHub browser extension that adds a sidebar to the page and set margin to body so that the sidebar would not overlap page content. I understand that primer is not responsible for handling of user's browser extension use case. But perhaps my use case has revealed a tiny defect of primer/behaviors and would help improve it. :)
@EnixCoda would you like to make a PR? With a PR we could try integrating it to see if there are any adverse effects (I think unlikely as we have margin:0 on body?).
Hi, I noticed that the tooltips in PR pages are not aligned properly when
body
hasmargin
set.Check out the comparison below, you can see the tooltip shifts
200px
relative to body between the 2 cases. And200px
is exactly themargin-left
set tobody
.200px
margin on bodyWhy would body has
margin
?I noticed this issue because I use a GitHub browser extension that adds a sidebar to the page and set margin to body so that the sidebar would not overlap page content. I understand that
primer
is not responsible for handling of user's browser extension use case. But perhaps my use case has revealed a tiny defect of primer/behaviors and would help improve it. :)Some insights I have noticed
Tooltip's position was set by
https://github.com/primer/view_components/blob/81eea01d0034c55771ce3e6c2afc685d364afc6c/app/components/primer/alpha/tool_tip.ts#L416-L417
And the position was calculated from
getAnchoredPosition
behaviors/src/anchored-position.ts
Line 140 in 6ed742f
In
getAnchoredPosition
, therelativeRect
has the correctleft
value for tooltip, if it was set to tooltip'sleft
style, it would align properly.behaviors/src/anchored-position.ts
Lines 153 to 156 in 6ed742f
However, the
relativeRect
was then passed topureCalculateAnchoredPosition
and it returned a differentleft
.behaviors/src/anchored-position.ts
Lines 290 to 379 in 6ed742f
Thank you for this awesome project!
The text was updated successfully, but these errors were encountered: