-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix(Popover): move position with target when in scroll container #2749
fix(Popover): move position with target when in scroll container #2749
Conversation
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.
all lgtm so far - can you link where this is used in the LE so i can test the fix in context?
@dreamwasp for sure. If you go to the Learn SQL course and tab onto the first "SQL" link, you should see a Docs tooltip. If you scroll while that tooltip is open, it will move with the target with this fix (https://tayra.codecademy.com/courses/learn-sql/lessons/manipulation/exercises/sql?PR_ENV=le-pr-2330) but not in prod (https://www.codecademy.com/courses/learn-sql/lessons/manipulation/exercises/sql) |
a5c20fa
to
addc71c
Compare
📬Published Alpha Packages:@codecademy/[email protected] |
🚀 Styleguide deploy preview ready! |
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.
noticed a small bug when you scroll to the top of the container but that being said, this is a huge improvement on the current behavior so am down for you to ship as is even if you can't tweak it. great work!
Overview
Move popover position with target when in a scroll container
We currently handle repositioning the popover so that it moves with the target when a user scrolls at the window level. However, we were not handling scrolling if the popover was within a container that scrolls while the window scroll is stationary (e.g. for narrative content on the LE). This PR introduces behavior to find the parent/ancestor element that is scrollable and ensure that the popover position is updated each time a scroll event is fired on that parent element.
PR Checklist
This PR includes unit tests for the code changeTesting Instructions
packages/styleguide/stories/Molecules/Popover/Popover.examples.tsx
PopoverExample
so that it returns something in a scroll container, e.g.PR Links and Envs