-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] Fix calculation for center aligned popover #2362
Conversation
Tophatting this fix in web locally. It currently looks like this, if we want it aligned with the activator on the right we need to set I can't replicate the issue @AndrewMusgrave had here #2231 (comment) |
margin: $visible-portion-of-arrow spacing(tight) spacing(); | ||
margin: $visible-portion-of-arrow 0 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why the popover needed margin on the horizontal axis as it is positioned absolutely.
right: | ||
preferredAlignment === 'right' ? horizontalPosition : undefined, | ||
left: preferredAlignment === 'right' ? 0 : horizontalPosition, | ||
left: horizontalPosition, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the right value and only positioning the popover with the left value. This is how it previously worked.
This simplifies the math when the popover overlaps the page. It now doesn't have to calculate a three right values it can just switch to a previously defined left value.
@@ -55,7 +55,6 @@ export function UserMenu({ | |||
|
|||
return ( | |||
<Menu | |||
preferredAlignment="right" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work with default middle, left or right alignment.
If the popover overlaps the right hand side of the page it should use a different left value.
Can we add a regression test for the previous bug? Also, do we have good test cases for the different positions? I’m just weary of this much code changing without any tests changing/being added that, while we might fix #2231 (comment), we could inadvertently introduce a new positioning bug. |
Closing as #2587 shipped. Thanks Tim. |
WHY are these changes introduced?
Re-re- fixes #1673
Fixes #2231 (comment)
WHAT is this pull request doing?
math.ts
prefferedAlignment="right"
on topbarHow to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes