-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Popover] Fix issue with Popover not being openable in a small Scrollable container #658
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
Conversation
👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. You can also join #polaris on the Shopify Partners Slack. |
Thanks so much for the contribution @JoelBesada! We'll give this a look through and get back to you Also, would you mind adding an entry to |
Co-Authored-By: JoelBesada <joel.besada@gmail.com>
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.
Could you add a test for what is expected if there is no intersection with the viewport?
And the 🎩 looks good, thanks for this fix! |
Thanks @tmlayton and @danrosenthal. I've added the test case for no intersection. |
Re-pinged reviewers for a fresh set of 👀 |
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.
My 🎩 in the playground and of various components using Popover in the yarn tophat
instance looked great. Code changes improve readability and expand test coverage. This is fantastic!
height: bottom - top, | ||
width: right - left, | ||
}); | ||
} |
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 change makes the code so much more readable 👍
@JoelBesada would you mind resolving this conflict so I can go ahead and merge? (unless any pinged reviewers have objections) |
@danrosenthal resolved |
Thanks! I'll merge on 🍏 |
🎉 Thanks for your contribution to Polaris React! |
WHY are these changes introduced?
(First Pull Request, here we go!)
Resolves #544.
It seemed like the implementation of
intersectionWithViewport
within thePopover
component returned some (what I would assume to be) unintended values in certain cases. In the case reported in the issue above, aRect
with a negative height is returned. I changed the implementation so this shouldn't happen anymore.I couldn't find any more context around this however, since the commit that added this function points to a PR that is not available here. I can only assume the expected behaviour based on the name of the function, but since I don't know the full intention of the original implementation I might be breaking something else here that's not caught by the tests. Please let me know!
WHAT is this pull request doing?
intersectionWithViewport
implementation to correctly clip the given rectintersectionWithViewport
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
You should be able to open and close the popover within the modal in the Playground example.
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist