-
Notifications
You must be signed in to change notification settings - Fork 843
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
Force popover contents to stay in the same position side once open #1199
Force popover contents to stay in the same position side once open #1199
Conversation
…nless window resizes
… have finished before locking the position; Fix popover positioning logic to disregard invalid alignments when forcing a position
@cchaos please test again with the context menu stuff, should be positioning correctly now @cjcenizal should have your 2nd case (jumping on first input) fixed now |
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.
It's working very well, there are some edge cases when the trigger is near browser edges, but I think those can be fixed in implementations and don't need to be handled here. Is there any way to possibly not visibly show the popover/context menu until it is in the new position? There's a flash of it in the wanted position until it re-positions. |
Thanks for testing again!
I'll ruminate on this for a bit. |
@cchaos I've updated context menu's panel rendering to not transition/animate the initial panel. This positions the panel correctly on initial showing. |
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.
Oh heck yeah! It works and looks soo much better now. The animation on first open was bugging us.
Closes #1187
Summary
Previously, a popover could jump to a different position (top, left, right, bottom) when its contents changed or onScroll (if the
repositionOnScroll
prop was passed). This PR changes the behaviour to lock the popover to whatever position it initially opens to, unless the window is resized.While it is locked to a side, the popover still re-positions to center content, keep the correct offset, and other position calculations - but it only calculates those for the now-forced position.
This is testable by editing the popover's DOM content in chrome dev tools.
Checklist
This was checked in mobileThis was checked in IE11This was checked in dark modeAny props added have proper autodocsDocumentation examples were addedThis was checked against keyboard-only and screenreader scenarios